第2个回答 2012-08-05
<form id="myform" method="post" action="test-2.html" onsubmit="return check()">
用户名:<input type="text" id="uname">
<input type="submit" value="提交" id="sub">
<script>
function check()
{
var nameValue=document.getElementById("uname").value;
if (!nameValue)
{
return false;
}
return true;
}
</script>本回答被提问者和网友采纳