...

View Full Version : Combining Window.Open with an Invoked button



JessieR3
12-29-2010, 07:44 PM
I've created a single form with multiple buttons. I am now attempting to have a couple of these buttons open a new window when clicked. The new window opens fine but the original browser window keeps opening to an [object Window] page. I believe this is because it is not reading the "return false" correctly but I am not sure how to fix this.


function invoke(btn)
{
if(btn == 0) document.Lockdate.action="Button1.php";
if(btn == 1) document.Lockdate.action="window.open('Button2.php'); return false;"

document.Lockdate.submit();
}

And then here is the code for the buttons themselves:


<input type="button" value="Button1" onclick="invoke(0)">
<input type="button" value="Button2" onclick="invoke(1)">

devnull69
12-30-2010, 06:49 AM
Easy enough ... you are returning false from the invoke function, but you are not returning it from the event handler:


<input type="button" value="Button1" onclick="return invoke(0)">
<input type="button" value="Button2" onclick="return invoke(1)">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum