AndieB Posted August 23, 2006 Share Posted August 23, 2006 Hi all GURUs!I would like to create a BUTTON with the <button></button> HTML code.In this <button> I'd like to add onClick function with the Javascript function to load a new page. I do not want to use the <A HREF> functionality.I think it would look something like this:[code]<button onClick="javascript:[b]the code I don't know[/b]" >click here to go on</button>[/code]What is the [b]javascript code[/b] I'm after?Thank you all in advance for any kind of help!--Andreas Link to comment https://forums.phpfreaks.com/topic/18380-javascript-and-button/ Share on other sites More sharing options...
GBS Posted August 23, 2006 Share Posted August 23, 2006 Hi,maybe try to do something like:<button onClick="javascript:testing()" >click here to go on</button>& the javascript part could be:[code]function testing(){window.open("your_page.html","the_page","width=310,height=400,left=320,top=0");}[/code]hoping it helps,l8tr,, Link to comment https://forums.phpfreaks.com/topic/18380-javascript-and-button/#findComment-79049 Share on other sites More sharing options...
radalin Posted August 23, 2006 Share Posted August 23, 2006 you can also use[code]window.location = "www.yourlink.com" ;[/code] Link to comment https://forums.phpfreaks.com/topic/18380-javascript-and-button/#findComment-79104 Share on other sites More sharing options...
AndieB Posted September 6, 2006 Author Share Posted September 6, 2006 Thank you, it worked perfectly!! Link to comment https://forums.phpfreaks.com/topic/18380-javascript-and-button/#findComment-87007 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.