SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Javascript alert problem!

    Hey there guys

    I have a simple form script with radio buttons that when i hit the submit button and "robot" is selected, it returns a pop up(alert) saying that it dosn't allow robots!!
    But the thing is that it returns TWO alerts????don't know why?

    Please help! here is my script:



    HTML Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    function submitted() {
    var robot = document.getElementById('one');
    var male = document.getElementById('two');
    var female = document.getElementById('three');
    if(robot.checked == true){
    alert("Go Away robot");
    return false;
    }
    
    }
    </script>
    </head>
    
    <body>
    <form name="form1" method="post" action="index.html" onsubmit="return submitted()">
      <p>
        <input  id="one" name="radiobutton" type="radio" value="robot" checked="checked" />
      robot
      <input id="two" name="radiobutton" type="radio" value="male" />
      male
      <input id="three" name="radiobutton" type="radio" value="female" />
      female</p>
      
      <input type="submit" name="Submit" value="Submit" onclick="submitted()"/>
    </form>
    </body>
    </html>
    Thanks
    Last edited by Toxinhead; Dec 9, 2007 at 04:07.


Bookmarks

Posting Permissions

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