JS判断当表单内容为空时,弹出警告框
(2012-06-05 15:48:03)
标签:
杂谈 |
分类: javascript |
<html>
<body><form name="sousuo" action="ss.php" id="sousuo" method="post" onsubmit="return
comfirm()">
<div style="margin:50px"><h2
style=" color:#C60; float:left; margin:30px 10px 30px
30px">请填写游戏名称:</h2><input
type="text" name="game_name" style=" margin:30px 30px 30px 0px"
maxlength="100" >
<input type="submit" value=" 搜索 " >
</div>
</form>
</body>
</html>
<script type="text/javascript">
function comfirm()
{
if(document.sousuo.game_name.value=="")
{
alert("内容不能为空");
return
false;
}
return
true;
}
</script>
<body><form name="sousuo" action="ss.php" id="sousuo" method="post"
<div style="margin:50px"><h2
<input type="submit" value=" 搜索 " >
</div>
</form>
</body>
</html>
<script type="text/javascript">
function comfirm()
{
</script>