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>