Karneet Posted August 28, 2013 Share Posted August 28, 2013 Hello Everyone, I am new JavaScript and would like to help my friend with her website. She wants the user to enter the data such as age and marital status. Check for a condition if the age is less than 25 and marital status is single she wants the user to see a specific message. In the same way if the age is more than 25 and status is single some other information. Can anyone please help me with it. Any help would be gratefully accepted. Link to comment Share on other sites More sharing options...
thescientist Posted August 28, 2013 Share Posted August 28, 2013 what do you have so far? which part are you stuck with? Provide code and specifics and then we will be able to help you. Link to comment Share on other sites More sharing options...
Karneet Posted August 29, 2013 Author Share Posted August 29, 2013 what do you have so far? which part are you stuck with? Provide code and specifics and then we will be able to help you. Hello Sir thank you for taking time and replying to me. the code i have so far is as follows: <html> <head> <script type="text/javascript"> function start(age(), abc()) { abc(); age(); } </script> </head> <body> if(age<25 && abc=yes) { alert("you can apply"); } else if( age>25 && abc =yes) { alert("you can apply"); } else if(age<25 && abc=no) { alert("no"); } else { alert("no"); } </body> </html> can you please tell me where i am going wrong. I would appreciate it Link to comment Share on other sites More sharing options...
thescientist Posted August 29, 2013 Share Posted August 29, 2013 (edited) Have you gone through the tutorials on javascript yet? I would highly recommend you do. You're going to need at minimum the knowledge on * how to include Javascript correctly on your page * how to define variables * how to correctly use operators * how to interact with the DOM; using something like document.getElementById, * how to write and call functions also you would need to use a browsers developer tools to check for errors, cause there would be many of them generated from this script. Once you have read through the tutorials, you need to think out your approach. * How does the user provide input? You have absolutely no HTML on your page within the body tags. You're going to at minimum need a couple input elements. * How do you get the user input? * Define the requirements of your function and the comparison logic One step at a time, but first you need to study to understand the basics. Edited August 29, 2013 by thescientist 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