<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1 align="center" style="color: red">用户留言簿</h1>
<hr color="red" />
<form action="baidu.html" method="post">
<table border="1" cellspacing="0" bordercolor="black" align="center" width="700px" height="300px" style="color: blue">
<tr>
<td width="100" height="50">用 户 名:</td>
<td><input type="text" name="name" /></td>
<td>密 码:</td>
<td><input type="password" name="pwd" /></td>
</tr>
<tr>
<td width="100" height="50">电子信箱:</td>
<td><input type="text" name="email" /></td>
<td>民 族:</td>
<td>
<select name="名族">
<option value="汉族" selected="selected">汉族</option>
<option value="少数名族">少数民族</option>
</select>
</td>
</tr>
<tr>
<td width="100" height="50">性 别:</td>
<td><input type="text" name="sex" />
<input type="radio" name="sex" value="男" checked="checked" />
<input type="radio" name="sex" value="女" />
</td>
<td>爱 好</td>
<td>
<input type="checkbox" name="lanqiu" value="aihao" />篮球
<input type="checkbox" name="zuqiu" value="aihao" />足球
<input type="checkbox" name="paiqiu" value="aihao" />排球
<input type="checkbox" name="qita" value="aihao" />其它
</td>
</tr>
<tr>
<td width="100" height="100">留 言:</td>
<td colspan="4">
<textarea name="liuyan" rows="5" cols="50">请多多指教</textarea>
</td>
</tr>
<tr>
<td height="50" colspan="5" align="center">
<input type="submit" value="确定" />
<input type="reset" value="重写" />
</td>
</tr>
</table>
</form>
</body>
</html>
HTML 代码留言板 一个超简陋的留言版 免费留言板 //评论内容不能保存 因为涉及到数据库<script>
function Ok_OnClick(event)
{
if(document.getElementsByName("textName")[0].value == ""){
alert("请输入内容")
return
}//getElementById
var table
var tableList = document.getElementsByTagName("TABLE")
for(var i = 0 i <tableList.length i++) {
if(tableList[i].name == "tableName") {
table = tableList[i]
break
}
}
var value = document.getElementsByName("textName")[0].value
var index = table.rows.length
table.insertRow(index)
table.rows(index).insertCell(0)
table.rows(index).cells(0).innerText = value
document.getElementsByName("textName")[0].value = ""
}
</script>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/htmlcharset=gb2312">
<TITLE>留言版</TITLE>
<STYLE>
td{width:20%height:20pxborder-bottom:1px solid blackborder-right:1px solid blackcursor:default}
div{font-size:13px}
th{height:20pxfont-size:12pxfont-weight:normalborder-bottom:2px solid blackbackground-color:#CCCCCC}
table{border:1px solid blackfont-size:13px}
</STYLE>
</HEAD>
<BODY oncontextmenu="return false"">
<TABLE name="tableName" width="70%" align="center" cellpadding="0" cellspacing="0">
<TR>
<TH colspan="4" style="">留言版</TH>
</TR>
<TR>
<TD>呵呵,一个超简陋的留言版 ^_^</TD>
</TR>
</TABLE>
<BR>
<div align="center">
<textarea rows="2" name="textName" id="textId" cols="20"
style="width: 70%clip: rect(0pt, 47pt, 18pt, 0pt)font-family: 宋体font-size: 10ptfont-weight: normalfont-style: normaltext-align: leftvertical-align: middletext-indent: 0color: #000000background-attachment: fixedbackground-color: #EEEEEEborder: 1px solid #0xf8f8f8">
</textarea>
</div>
<BR>
<div align="center">
<input type="button" value="提交" onclick="return Ok_OnClick(window.event)"
style="align:center width:60 height: 21clip: rect(0pt, 47pt, 18pt, 0pt)font-family: 宋体font-size: 10ptfont-weight: normalfont-style: normalcursor: handtext-align: centervertical-align: middletext-indent: 0color: #000000background-attachment: fixedbackground-color: #d8d8d8border: 1px solid #59b4f7">
<!--position: absoluteleft: 342top: 184-->
</div>
</BODY>
</HTML>
1、加一个html标签就可以了 ,<input type="reset" style="background:url(背景图片路径)" name="reset" value="">这个就是了,复制可以了,value设置为空就可以了。
2、合理的运用图片,能够使站点更加丰富多彩,相信有许多喜欢用图片的设计师都遇到过一个问题:用图片实现表单(form)的重置(reset)按钮时,这个按钮并不能重置表单,相反却执行了提交表单的 *** 作,本文说明了这个问题的原因,并给出了相应的解决方案。
3、出现上述问题的原因主要是:普通的按钮是通过类型来区分的,submit 为提交按钮,reset 为重置按钮,而类型为图片(type="image")的按钮,其默认 *** 作是提交表单。因此,如果想用图片实现重置按钮,就需要一些额外的设置了。
4、如果想用图片代替重置按钮,可以用下面的方法:(1)给 type 为 image 的 input 添加onclick事件来实现重置,并通过添加 return false 来避免默认的提交 *** 作:<form method="post" name="testForm_2" action="">, <p><input type="text" name="keyword" /></p>, <input type="image" src="send.gif" />, <input type="image" src="reset.gif" ,nclick="javascript:document.forms['testForm_2'].reset()return false" /></form>document.forms['testForm_2'].reset() 是将名称为 testForm_2 的表单重置。return false 是防止提交表单。
5、直接用图片模拟的重置按钮
<form method="post" name="testForm_3" action="">
<p><input type="text" name="keyword" /></p>
<input type="image" src="send.gif" />
<imgsrc="reset.gif" alt="Reset" onclick="javascript:document.forms['testForm_3'].reset()" style="cursor:pointer" />
</form>
document.forms['testForm_2'].reset() 是将名称为 testForm_2 的表单重置。style="cursor:pointer" 设置图片悬停时,显示手型光标。两种方法大同小异,在javascript被禁止的情况下,第二种方法按钮不会执行任何 *** 作,而第一种方法却会执行提交 *** 作。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)