Form onsubmit 事件 阻止表单提交() 必须选中同意选项才可以提交

 

 

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
function greeting(){
alert("Welcome " + document.forms["frm1"]["fname"].value + "!")
}
</script>
</head>
<body>

你的名字是:<br>
<form name="frm1" action="tryjsref_form_onsubmit.htm" onsubmit="greeting()">
  <input type="text" name="fname">
  <input type="submit" value="提交">
</form>

</body>
</html>

 

必须选中同意选项才可以提交

posted on 2016-12-12 16:28  星河赵  阅读(901)  评论(0编辑  收藏  举报

导航