Jump to content

Karriz

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Karriz

  1. I'm currently making a quiz-like math test site, and I use text field forms, and Javascript to check the answer. This is the code I currently have for text forms: <html> <head><title>Test</title> <script type="text/javascript">function validateForm(){var x=document.forms["Answer"]["Check answer"].value;if (x=="2"){alert("You're right, 2 is the correct answer!");;}else{alert("Wrong answer, 2 is correct.");;}} </script></head> <body> How much is 1+1? <form name="Answer"onsubmit="return validateForm()" method="post"><inputname="Check answer" value=""><br> <br><input value="Check answer" type="submit"><br></form> </body></html> Now I'd like to make questions which have multiple choices, like: a: 2b: 56c: 1 I know this should be possible with radio buttons, but simply changing the form type doesn't make it work. I don't have any real coding experience so I'd be really thankful if somebody could help. Edit: for some reason I can't put the html inside quote tags.
×
×
  • Create New...