0

I am trying to make a button to open a page when clicked using window.open, but it doesn't do anything

<input type = "button" value="Two Players" onClick = "window.open(Two.html);">
1
  • 1
    It would have shown an error that says something like "undefined is not an object", because you're trying to access the .html property of Two which is not the same as the string 'Two.html'. Commented May 10, 2014 at 3:07

1 Answer 1

7
<input type = "button" value="Two Players" onclick = "window.open('Two.html');">

and not

<input type = "button" value="Two Players" onclick = "window.open(Two.html);">

Dont' forget the two : '' for your path Two.html

FIDDLE: http://jsfiddle.net/abdennour/XqsC5/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.