首页 > 用了alert和function函数,不出弹框啊?

用了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>
为啥不出弹框呢?求解


不弹出?有没有报什么错误?或者用console.log("【请输入姓名】!")调试


楼主拼错名字了吧 Submit...


你好好检查检查你代码吧!!!!!

<form id="form1" runat="server" action="WebForm25.aspx" onsubmit="return form1Submit();">

function form1Sumbit() {

方法名都不对着!

【热门文章】
【热门文章】