birdycarolyn
08-26-2003, 09:33 AM
I'm very new to Javascript and was hoping someone could help me out. I am working on a form that has two buttons. However, each button needs to call a separate page that obtains results from a database, so I'm dynamically setting the ACTION and TARGET properties of the form through the following code:
<INPUT type="button" value="View Results" name=button1 onclick="return OnButton1();">
<INPUT type="button" value="Printer Friendly" name=button2 onclick="return OnButton2();">
function OnButton1()
{ document.Form1.action = "results_vr1.asp";
document.Form1.target = "_self";
document.Form1.submit();
return true;
}
function OnButton2()
{ document.Form1.action = "results_vr2.asp"
document.Form1.target = "_blank";
document.Form1.submit();
return true;
}
In function OnButton2(), the target is set to _blank which is what I want, but at the same time I would like to incorporate the Window.Open command to control how the window opens and it's width and height:
window.open("results_vr2.asp", "newwindow", "resizeable=yes,scrollbars=yes,toolbar=yes,menubar=yes,width=750,height=550,innerWidth=750,innerHeigh t=550,left=0,top=0");
Does anyone know how I can incorporate the 2? As a bonus, does anyone know how I can keep sending my data to the opened blank window so that I don't have many windows opened every time they choose the button (in other words, keep the focus on that window while refreshing the data table within it)?
I hope I am being clear and appreciate any help! Carolyn
<INPUT type="button" value="View Results" name=button1 onclick="return OnButton1();">
<INPUT type="button" value="Printer Friendly" name=button2 onclick="return OnButton2();">
function OnButton1()
{ document.Form1.action = "results_vr1.asp";
document.Form1.target = "_self";
document.Form1.submit();
return true;
}
function OnButton2()
{ document.Form1.action = "results_vr2.asp"
document.Form1.target = "_blank";
document.Form1.submit();
return true;
}
In function OnButton2(), the target is set to _blank which is what I want, but at the same time I would like to incorporate the Window.Open command to control how the window opens and it's width and height:
window.open("results_vr2.asp", "newwindow", "resizeable=yes,scrollbars=yes,toolbar=yes,menubar=yes,width=750,height=550,innerWidth=750,innerHeigh t=550,left=0,top=0");
Does anyone know how I can incorporate the 2? As a bonus, does anyone know how I can keep sending my data to the opened blank window so that I don't have many windows opened every time they choose the button (in other words, keep the focus on that window while refreshing the data table within it)?
I hope I am being clear and appreciate any help! Carolyn