你可以写一个判断的函数,然后在提交的时候调用这个函数,检查.
如:
<html>
<head>
<script language="javascript">
function Test()
{
if(document.getElementById("TextBox1").value=="")
{
alert("不能为空");
}
}
</script>
</head>
<body>
<form>
<input type="text" id="TextBox1">
<input type="button" onclick="Test()" id="Button1">
</form>
</body>
</html>
如:
<html>
<head>
<script language="javascript">
function Test()
{
if(document.getElementById("TextBox1").value=="")
{
alert("不能为空");
}
}
</script>
</head>
<body>
<form>
<input type="text" id="TextBox1">
<input type="button" onclick="Test()" id="Button1">
</form>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货