无法运行HTML来实现告警窗口的显示

 <!DOCTYPE html>
<html>
  <head>
    <title>js24.html</title>

    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=GB18030">

    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

    <script type="text/javascript">
    function moveNext(object, index) {
        if(object.value.length == 4) {
            document.forms[0].elements[index + 1].focus();
        }
    }

    function showResult() {
        var f = document.forms[0];
        var result = "";

        result = document.forms[0].elements[0].value;

        alert(result);
    }


    </script>
  </head>

  <body onload="document.forms[0].elements[0].focus();">
    <form>
    <input type="text" size="3" maxlength="4" onkeyup="moveNext(this, 0)">-
    <input type="text" size="3" maxlength="4" onkeyup="moveNext(this, 1)">-
    <input type="text" size="3" maxlength="4" onkeyup="moveNext(this, 2)">-
    <input type="text" size="3" maxlength="4" onkeyup="moveNext(this, 3)">

    <input type="button" value="show" onclick="showResult();">
    </form>
  </body>
</html>

想通过这个html代码,来实现四个四位数的输入后,在告警窗口栏显示输入的数字。
但是,点击show按钮了以后,无法实现告警窗口。求大神解答。

目测,showResult();你的标点用成全角了
而且,你为什么用form[0].element[0],你应该最好用id定位。

 function showResult() {
    var result = document.getElementById("show").value;
    alert(result);
}
</script>

<input type="button" id="show" value="show" onclick="showResult();">
</form>

这样试试。

楼主 js的调试 你可以在chrome中下断点 也可以单步alert 来判断 哪一步未执行

去掉showResult();后的中文分号,你的这个分号是中文状态下,要么就输入英文状态下的

 <input type="button" value="show" onclick="showResult()" />