0

Explorer はコード内のループを無視し、var id で何もしません。数字があるときとないときを教えてくれるはずだとチェックする限り、私はそれについて本当に混乱しています。

<!DOCTYPE html> 
<html> 
    <body>
    <script language="javascript" type="text/javascript">
    <!--
        var c;
        var id;
        var x=prompt("let´s see if this work.");
        c =(x.length);
        alert("have " + c + " characters ");
        alert("Last character is " + x.substring((c-1), c));

        // loop supposed to  check ever character and stop when counter "c" reach 0.
        //id is supposed to become false if there is a number inside and stop the loop
        // for some reason firefox is skipping loop
        while (c!=0 && id===true)
        {
            alert("start in " + c);
            id=isNaN(x.substring((c-1), c));
            c=(c-1);
            alert("ends in " + c);
        }
        // id true mean no nomber id false mean there is a number
        if (id === true)
        {
            alert("No number inside")
        }
        else
        {
            alert("number inside");
        }
    </script>
    </body>
</html>
4

1 に答える 1