<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户名</title>
</head><body><script type="text/javascript" language="javascript">
function clear()
{
document.f1.Text1.value="";
}
</script><table style="width: 100%">
<tr>
<td style="width: 308px">用户名</td>
<td>
<form method="post" action="" style="margin: auto" name="f1">
<input name="Text1" type="text" />
</form>
</td>
</tr>
</table>
<form method="post" action="">
<input name="Reset1" type="reset" value="重置" onclick="clear()" /></form></body></html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户名</title>
</head><body><script type="text/javascript" language="javascript">
function clear()
{
document.f1.Text1.value="";
}
</script><table style="width: 100%">
<tr>
<td style="width: 308px">用户名</td>
<td>
<form method="post" action="" style="margin: auto" name="f1">
<input name="Text1" type="text" />
</form>
</td>
</tr>
</table>
<form method="post" action="">
<input name="Reset1" type="reset" value="重置" onclick="clear()" /></form></body></html>
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户名 </title>
</head> <body> <script type="text/javascript" language="javascript">
function clear()
{
document.f1.Text1.value="";
}
</script> <table style="width: 100%">
<tr>
<td style="width: 308px">用户名 </td>
<td>
<form method="post" action="" style="margin: auto" name="f1">
<input name="Text1" type="text" />
</form>
</td>
</tr>
</table>
<form method="post" action="">
<input name="Reset1" type="reset" value="重置" /> </form>
</body> </html> 红色的去掉
<input name="Text1" type="text" />
</form>
</td>
</tr>
</table>
<form method="post" action="">
<input name="Reset1" type="reset" value="重置" onclick="clear()" /> </form></body></html>
------------
你这里几个<form/>标签了?改成这个<form method="post" action="" style="margin: auto" name="f1">
<input name="Text1" type="text" /></td>
</tr>
</table><input name="Reset1" type="reset" value="重置" onclick="clear()" /> </form></body></html>
或者你将变更为 type="button"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户名 </title>
</head>
<body>
<form method="post" action="" style="margin: auto" name="f1">
<table style="width: 100%">
<tr>
<td style="width: 308px">用户名 </td>
<td>
<input name="Text1" type="text" />
<input name="Reset1" type="reset" value="重置"/>
</td>
</tr>
</table>
</form>
</body>
</html>
你原来的代码中函数名字有问题。
clear是保留字
换个函数名字就可以了。
既然type是reset了为什么 还要去 onclick="clear()" 呢 ?