Using Window.open with dynamic Form buttons
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   carolyn_birdy
Posted On:   Tuesday, August 26, 2003 07:26 AM

Hello Gurus, 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: 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   More>>

Hello Gurus,



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:



			



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,innerHeight=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    <<Less

Re: Using Window.open with dynamic Form buttons

Posted By:   Joost_Schouten  
Posted On:   Tuesday, August 26, 2003 08:44 AM

This should do the trick. Alter where required.




onClick="return OnButton1();">

onClick="return OnButton2();">





Good luck

joost

About | Sitemap | Contact