Jump to content

If answer is wrong


Fire Dragon

Recommended Posts

I made prompt box,and it works nicely,but I have little problem.I want so if user answers wrong,program redirectes you to new page.I tried else,and if,but I can't get it work.Please help!Here is my code:

<html><head><meta http-equiv="Refresh"content="10;url=http://www.w3schools.com"><script type="text/javascript">function question()var answer=prompt("Who you are?","")if (answer == "Idiot"){window.location="http://www.w3schools.com"}</script><script type="text/javascript">function question(){var answer=prompt("Who you are?","")if (answer == "Idiot"){window.location="http://www.w3schools.com"}}</script></head><body><form><input type="button" onclick="question()" value="Click!"></form></body></html>

I know how I can transfer user to new page,but I don't know how make it so that when user answers any other word,it transfers you to another page.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...