rms230 Posted June 9, 2006 Share Posted June 9, 2006 can anyone help me make a quiz the radio button bits are ok its just validating the buttons to display either a wrong answer and the wright answer or the wright answer Link to comment Share on other sites More sharing options...
scott100 Posted June 9, 2006 Share Posted June 9, 2006 Here's an example for you, it's about as easy as i can make it.When the radio button is clicked it sends the value to the function, the function checks the data and displays an alert. <html><head><script>function check(val){if(val=="Blue")alert("Welldone "+val+" is correct");else alert("Sorry "+val+" is incorrect");}</script></head><body><form><p>What color is the sky?</p><input type="radio" name="q1" value="Red" onclick="check(this.value)">Red<input type="radio" name="q1" value="Green" onclick="check(this.value)">Green<input type="radio" name="q1" value="Blue" onclick="check(this.value)">Blue</form></body></html> Any more questions let me know 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