joemamahunt Posted September 2, 2007 Share Posted September 2, 2007 Searched but can't find the answer. I need to to also be XHTML valid. This is closest I've gotten. <input type="button" value="Click Here" onclick="window.location.href=\'http://www.x.net/x.php\' /> But doesn't work. Thank you. Quote Link to comment Share on other sites More sharing options...
php_tom Posted September 2, 2007 Share Posted September 2, 2007 This works for me: <input type="button" value="Click Here" onclick="javascript:window.location.href='http://www.google.com'" /> But note that it's JS, you should have posted in the JS board. Hope it helps. Quote Link to comment Share on other sites More sharing options...
joemamahunt Posted September 2, 2007 Author Share Posted September 2, 2007 Oh.. Thanks, that works. My bad about it being Javascript, didn't think about it. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted September 2, 2007 Share Posted September 2, 2007 onclick="window.location.href=\'http://www.x.net/x.php\' You didn't enclose the entire attribute in double quotes. You didn't need to escape the single quotes since they were inside of double quotes. Thought you should know why it wasn't working. Quote Link to comment Share on other sites More sharing options...
joemamahunt Posted September 2, 2007 Author Share Posted September 2, 2007 Yeah, I can't believe I didn't close it. I needed to escape the single quotes because I'm using it in a PHP code. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 2, 2007 Share Posted September 2, 2007 ??? Tut tut. A link to another page is a link NOT A BUTTON. use <a> tags add teh onclick and onkeypress atribributes to open the new window... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.