问候,我有这个输入字段,
<input name="question"/>我想在提交点击提交按钮时调用IsEmpty函数.
我尝试了下面的代码,但没有奏效.有什么建议吗?!
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=unicode" />
<meta content="CoffeeCup HTML Editor (www.coffeecup.com)" name="generator" />
</head>
<body>
<script language="Javascript">
function IsEmpty() {
if (document.form.question.value == "") {
alert("empty");
}
return;
}
</script>
Question: <input name="question" /> <br/>
<input id="insert" onclick="IsEmpty();" type="submit" value="Add Question" />
</body>
</html>Run Code Online (Sandbox Code Playgroud) javascript ×1