Jason28 Posted August 17, 2009 Share Posted August 17, 2009 Could anyone please give me a code that allows a submit type button to open up a window for another page? I tried to use this: <input value="Play All" type="button" href="test.php?genre='.$genre_select.'" onClick="openWin(this.href, \'280\', \'500\', \'yes\')\';" target="_blank" /> However it does nothing. This next code opened up a broken window but opened up the working link in another full window: <input value="Play All" type="button" href="player/test.php?genre='.$genre_select.'" onClick="openWin(this.href, \'280\', \'500\', \'yes\')\';" target="_blank" /> I wonder if I can somehow combine the two so that it just opens up the window? BTW I am aware of the escaped \ before the apostrophes, they have to be there since I am outputting this code using php that has single quotes in the string. Thanks. Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/ Share on other sites More sharing options...
MadnessRed Posted August 17, 2009 Share Posted August 17, 2009 I think the function is window.open onclick="window.open (this.href, "mywindow","location=1,status=1,scrollbars=1, width=280,height=500");" does that work? Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900484 Share on other sites More sharing options...
Jason28 Posted August 17, 2009 Author Share Posted August 17, 2009 yes, but I can combine the two and only allow one window to open? I am not good with javascript. Thanks! Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900486 Share on other sites More sharing options...
MadnessRed Posted August 17, 2009 Share Posted August 17, 2009 yes, but I can combine the two and only allow one window to open? I am not good with javascript. Thanks! so you want the submit button to submit the form, and then open up a new window? if so could you not put the new winfow into the onload of whatever page the form submits to? eg <body onload="window.open (this.href,'mywindow','location=1,status=1,scrollbars=1,width=280,height=500');"> Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900489 Share on other sites More sharing options...
Jason28 Posted August 17, 2009 Author Share Posted August 17, 2009 Nope no form action please. The button is within another form, so I had to use the location for it the first time to prevent conflicts. I basically just use the button for cosmetic purposes, not to serve as a submit button. Thanks! Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900490 Share on other sites More sharing options...
MadnessRed Posted August 17, 2009 Share Posted August 17, 2009 so you want to click the button and have a window open, and thats it? Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900494 Share on other sites More sharing options...
Jason28 Posted August 17, 2009 Author Share Posted August 17, 2009 Yes exactly Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900495 Share on other sites More sharing options...
MadnessRed Posted August 17, 2009 Share Posted August 17, 2009 <input value="Play All" type="button" onclick="window.open(\'test.php?genre='.$genre_select.'\',\'_blank\');" /> does that work? Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900502 Share on other sites More sharing options...
Jason28 Posted August 17, 2009 Author Share Posted August 17, 2009 Sorta, it opens in another window, but not a small window with set width/height and stuff. Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900509 Share on other sites More sharing options...
MadnessRed Posted August 17, 2009 Share Posted August 17, 2009 ok, thats because browser like opening in a new tab, not a new window, i found a way though... <input value="Play All" type="button" onclick="window.open(\'test.php?genre='.$genre_select.'\',\'_blank\',\'location=1,width=280,height=500\');" /> Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900522 Share on other sites More sharing options...
Jason28 Posted August 17, 2009 Author Share Posted August 17, 2009 Works perfectly thanks a lot Just had to switch the height and width vars around. Man it's like you guys get paid to be nice and helpful Link to comment https://forums.phpfreaks.com/topic/170735-solved-possible-to-make-button-open-up-another-page-in-a-window/#findComment-900524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.