javascript - 用了alert和function函数,不出弹框啊?
本文介绍了javascript - 用了alert和function函数,不出弹框啊?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
<html xmlns="http://www.w3.org/1999/xhtml&...
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>提交</title>
</head>
<body>
<form id="form1" runat="server" action="WebForm25.aspx" onsubmit="return form1Submit();">
<div>
<label>
姓名:
<input id="nameInput" type="text" />
</label>
<input type="submit" value="提交" />
</div>
</form>
<script type="text/javascript">
function form1Sumbit() {
var nameInput = document.getElementById("nameInput");
if (nameInput.value == "") {
alert("【请输入姓名】!");
nameInput.focus();
return false;
}
}
</script>
</body>
</html>
为啥不出弹框呢?求解
解决方案
楼主拼错名字了吧 Submit...
这篇关于javascript - 用了alert和function函数,不出弹框啊?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文