Fire Dragon Posted January 23, 2006 Share Posted January 23, 2006 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 More sharing options...
pulpfiction Posted January 23, 2006 Share Posted January 23, 2006 HiThis seems to be working fine for me..function question(){var answer=prompt("Who you are?","")if (answer == "idiot"){window.location="http://www.w3schools.com"}elsewindow.location="http://www.google.com"} Link to comment Share on other sites More sharing options...
Fire Dragon Posted January 23, 2006 Author Share Posted January 23, 2006 Eh,what? Link to comment Share on other sites More sharing options...
pulpfiction Posted January 23, 2006 Share Posted January 23, 2006 I didnt read the question exactly last time, ignore that replytry the new one, I just modified the old post Link to comment Share on other sites More sharing options...
Fire Dragon Posted January 23, 2006 Author Share Posted January 23, 2006 I didnt read the question exactly last time, ignore that replytry the new one, I just modified the old post<{POST_SNAPBACK}> OK,I understand.And thank you veeeery much!That thing was near drive me crazy!Finally I can finalize my game... 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