Chikwado Posted January 8, 2015 Share Posted January 8, 2015 (edited) Some one check this: I made the following code to validate "Username" which work fine. [color=green]<html>[/color] <body> <script> function ValidateForm() { var x = document.forms["myForm"] ["fname"].value; if(x == " ") || (x == " ") { alert("Please Input Your Name!"); return false; } } [/code ] That is: If the input is correct it will accept it but if the input is incorrect it will reject. How to modify that code so that when the input is incorrect it will say, "Your Input Is Incorrect" and when the input is correct, it will say: "You have succefully registered with us as "Username". some one check it. Edited January 10, 2015 by Chikwado Link to comment Share on other sites More sharing options...
Ingolme Posted January 8, 2015 Share Posted January 8, 2015 First, do you understand what the code does? Link to comment Share on other sites More sharing options...
thescientist Posted January 8, 2015 Share Posted January 8, 2015 what have you tried? What specifically are you having trouble with? I curious though, because If that is indeed your original code, then surely it should be a trival change to change to alter the output text and add an else conditional. At the very least, present what you've tried, we're not going to do it for you. Also, please use code tags when posting code. At the very least, separate it from the body of your post. Link to comment Share on other sites More sharing options...
Chikwado Posted January 8, 2015 Author Share Posted January 8, 2015 Yes I want to use code tag but have never learn how to use it, I only know html, Do you know any where available? Link to comment Share on other sites More sharing options...
Ingolme Posted January 8, 2015 Share Posted January 8, 2015 You can learn Javascript at the W3Schools Javascript tutorial: http://www.w3schools.com/js/default.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now