<script>
function validateForm() {
var x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("必须填写姓名!");
return false;
}
}
</script>
</head>
<body>

<form name="myForm" action="/demo/action_page.php" onsubmit="return validateForm()" method="post">
姓名:<input type="text" name="fname">
<input type="submit" value="提交">
</form>

相关文章:

  • 2021-08-27
  • 2021-09-29
  • 2021-09-28
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2021-10-29
猜你喜欢
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2021-04-09
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案