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. Quote Link to comment 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? Quote Link to comment 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! Quote Link to comment 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');"> Quote Link to comment 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! Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
Jason28 Posted August 17, 2009 Author Share Posted August 17, 2009 Yes exactly Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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\');" /> Quote Link to comment 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 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.