Jump to content

Search the Community

Showing results for tags 'javascript beginner'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Dear All, I have been learning JS recently.i am trying to wirte code for Form Validation:For form Validation I am using Radio buttons for Gender: Its working but i can able to select both Options there is no Validation Code: if ( ( document.getElementById('gender1').checked ==false ) && ( document.getElementById('gender2').checked ==false) ) { alert("please select any on of them"); return false; } Could you anyone help me to find out. If possible please reply with Code. <html> <head> <title>form validation</title> <script LANGUAGE="JavaScript"> function validate() { if(document.getElementById('fname').value =='') { alert("please enter firstname"); document.getElementById('fname').focus(); return false; } if(document.getElementById('lname').value =='') { alert("please enter last name"); document.getElementById('lname').focus(); return false; } if(document.getElementById('age').value =='') { alert("please enter age"); document.getElementById('age').focus(); return false; } if ( ( document.getElementById('gender1').checked ==false ) && ( document.getElementById('gender2').checked ==false) ) { alert("please selece any on of them"); document.getElementById('gender1').focus(); return false; } if(document.getElementById('email').value =='') { alert("please enter email"); document.getElementById('email').focus(); return false; } if(document.getElementById('uid').value =='') { alert("please enter Userid"); document.getElementById('uid').focus(); return false; } if(document.getElementById('password').value =='') { alert("please enter password"); document.getElementById('password').focus(); return false; } if(document.getElementById('confirm').value =='') { alert("please enter password"); document.getElementById('confirm').focus(); return false; } else { alert("thanks"); } } </script> </head> <body > <center> <table id="table1"> <tr> <td>First Name:</td> <td><input type="text" id="fname" name="fname" /></td> </tr> <tr> <td>Last Name:</td> <td><input type="text" id="lname" name="lname" /></td> </tr> <tr> <td>Age:</td> <td><input type="text" id="age" name="age" /></td> </tr> <tr> <td>Gender:</td> <td><input type="radio" id="gender1" name="gender1" value="M" />Male</td> <td><input type="radio" id="gender2" name="gender2" value="F" />FeMale</td> </tr> <tr> <td>Email:</td> <td><input type="text" id="email" name="email" /></td> </tr> <tr> <td>User Id:</td> <td><input type="text" id="uid" name="uid" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" id="password" name="password" /></td> </tr> <tr> <td>Confirm Password:</td> <td><input type="password" id="confirm" name="confirm" /></td> </tr> <tr> <td><input type="button" id="button" value="Submit" onclick="validate()";finalValidate();"/></td> </tr> </table> </center> </body> </html> Regards, Muthamizh.T Tell me the exact code to validate the radio Buttons using with the above codeCould you Please anyone help me to get a solution:
×
×
  • Create New...