Can't figure this error out?

Discussion in 'JavaScript' started by pHrEaK, Feb 17, 2011.

  1. #1
    Have this extremely simple code and cannot figure out where the error is that's keeping it from running?

    
    <script type="text/javascript">
    /* <![CDATA[ */
    
    function wLoop(count)	{
    count = parseInt(count);
    	if(count == 10){
    		document.alert("number is too large");
    		}
    	}
    
    /* ]]> */
    </script>
    
    </head>
    <body>
    <form name="loops">
    	<p>Enter a number between 1 - 9999</p>
    		<input name="wLoopText" type="text"/><br/>
    		<input type="button" value="While Loop" onclick="wLoop(document.loops.wLoopText.value)" name="wLoopButton"/><br/>
    <br/>
    	<p>Enter a number between 1 - 9999</p>
    		<input name="fLoopText" type="text"/><br/>
    		<input type="button" value="For Loop" onclick="fLoop()" name="fLoopButton"/><br/>
    </form>
    
    /* ]]> */
    </script>
    
    Code (markup):
    Can anyone else see this error that i'm guessing is extremely obvious?
     
    pHrEaK, Feb 17, 2011 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Remove document from this line:
    document.alert("number is too large");

    There are no opening tags for this at the end.
    /* ]]> */
    </script>


    Hope that helps :)
     
    Cash Nebula, Feb 17, 2011 IP
  3. pHrEaK

    pHrEaK Active Member

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    omg...! lol...yeah that document.alert needed to be a window.alert....thanks for pointing me in the right spot!
     
    pHrEaK, Feb 17, 2011 IP