New line in a prompt?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Computer Guru
    New Member
    • Mar 2008
    • 16

    New line in a prompt?

    Prompts and alerts are usually one lined. However, my prompt statement is rather long and does not fit on one line. With js alerts I use something like this...

    <a href="javascrip t:alert('a'+'\n '+2+'\n'+'b');" >test</a>


    but this doesn't seem to work with my prompt.


    [HTML]<script>
    function ask()
    {
    pass=prompt("Th is feature will be available to non-members until July 5th 2008. Enjoy the free surfing! abc123","");
    if(pass=="abc12 3" && pass!=null)
    {
    alert("Correct password. Access granted")
    }
    else { alert("Incorrec t password. Access denied") window.location .href="http://shamtech.webs.c om/loginfailure.ht m"; }
    }
    window.onload=a sk
    //stop-->
    </script>[/HTML]


    Please help!
  • eWish
    Recognized Expert Contributor
    • Jul 2007
    • 973

    #2
    Moving to the JavaScript Forum.

    --Kevin

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      On line 9, you have two statements without a semi-colon in between. It's always a good habit to end your statements with semi-colons anyway.

      Comment

      Working...