Why won't windows.alert work?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Connelly
    New Member
    • Jan 2011
    • 103

    Why won't windows.alert work?

    I am learning javascript with help of tutorials and have typed this simple code.
    Code:
    <html>
    <body>
    <title>Windows and Window Properties</title>
    
    <script language ="javascript">
    Response ="";
    while((Response=="")||(Response =="<undefined>")){
    	Response=window.prompt("Please Enter your Name");
    }
    if(response == "undefined")
    	{
    	window.alert("Hello, Welcome to our page!");
    	}
    else 
    {
    	window.alert("Hello, " + Response + "! Welcome to our page!");
    }
    document.write("<br> THis is the content of the window.html page: <br>")
    </script>
    
    </body>
    </html>
    When I run the page in Chrome, IE, and Firefox the window.prompt works as should. The rest of the code fails. It should alert me either of the two alerts depending if the user enter a name, but it does nothing nor does it do the document.write. Any suggestions or answers would be greatly appreciated.
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    'Response' is not the same as 'response'. I'm sure there is also an issue with 'undefined' and how you equate it but I'm on the run.

    Comment

    • Brian Connelly
      New Member
      • Jan 2011
      • 103

      #3
      Thanks for the oversight on Response, I fixed that. But still no luck on moving forward.

      Comment

      • Brian Connelly
        New Member
        • Jan 2011
        • 103

        #4
        You were correct. It was just some formatting errors.

        Comment

        Working...