<script lanuage="javascript">
function ti()
{alert(document.write(document.form1.user.value));
}
</script>
</head><body>
<form action="a.html" method="post" name="form1">
用户名:<input type="text" name="user" value="username" /><br />
密 码 :<input type="password" name="pwd" /><br /><br />
性 别 :<input type="radio" value="男" checked="checked" name="sex" />男 <input type="radio" value="女" name="sex" />女<br /><br />
<input type="submit" name="submit" value="提交" onclick="ti()"/>
<input type="reset" name="reset" value="重置" />
</form>
function ti()
{alert(document.write(document.form1.user.value));
}
</script>
</head><body>
<form action="a.html" method="post" name="form1">
用户名:<input type="text" name="user" value="username" /><br />
密 码 :<input type="password" name="pwd" /><br /><br />
性 别 :<input type="radio" value="男" checked="checked" name="sex" />男 <input type="radio" value="女" name="sex" />女<br /><br />
<input type="submit" name="submit" value="提交" onclick="ti()"/>
<input type="reset" name="reset" value="重置" />
</form>
function ti()
{ alert(document.form1.user.value);
}
</script>这样就可以了
<head>
<script lanuage="javascript">
function ti()
{
//document.write(document.form1.user.value);
alert(document.form1.user.value);
}
</script>
</head> <body>
<form action="a.html" method="post" name="form1">
用户名: <input type="text" name="user" value="username" /> <br />
密 码 : <input type="password" name="pwd" /> <br /> <br />
性 别 : <input type="radio" value="男" checked="checked" name="sex" /> 男 <input type="radio" value="女" name="sex" /> 女 <br /> <br />
<input type="submit" name="submit" value="提交" onclick="ti()"/>
<input type="reset" name="reset" value="重置" />
</form>
</body>
楼主这样修改 或者注释alert 留上面的一行