<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hello word</title>
<script type="text/javascript">
function check(){
var x=document.forms["toupiao"]["name"].value;
if(x==null||x=="")
{
alert("名字不能为空!");
}else{
alert(x);
}
}
</script>
</head>
<body>
<form name="toupiao" method="post">
The name is:<input type="text" name="name">
<input type="submit" name="submit" onclick="check()">
</form>
</body>
</html>
时间: 2024-12-29 11:35:20