Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Button wont work unless refreshed

    Hi .. !! everything works fine in this code.. but the only problem I can use the button just once, unless I refresh the page. Thanks in advance. _________________________________________________________________
    <html>
    <head>
    <
    <script type="text/javascript">
    function email()
    {
    email = window.prompt("WHAT IS YOUR E-MAIL ADDRESS?");
    test ()
    }
    function test()
    {
    if (email.indexOf('@') != -1)
    { alert ("VALID E-MAIL");
    write() }
    else
    { alert("INVALID EMAIL"); }

    }
    </script>
    <title>Page 6</title>
    </head>

    <body>
    <form>
    <input type="button"
    onclick="email()"
    value="Click Here !!">
    </form>

    <script type="text/javascript">
    function write()
    {
    alert("Thankyou For Entering Your E-Mail Address");
    }
    </script>

    </body>
    </html>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The problem is in..
    email = window.prompt("WHAT IS YOUR E-MAIL ADDRESS?");

    Once it executed, the email function disappears !

    Change that variable name to say 'email1' and make changes in the following lines also..


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •