Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

post to a window of a certain size

Status
Not open for further replies.

nmath

Programmer
Dec 12, 2003
47
US
I am having a little problem with forms and getting the page that I want to go to a certain size. Originally, I used javascript to open a new window but since the page that I open needs to post data back to the parent that called it I ran into problems. If you close the parent window using a window.close I get an IE alert which is far less than desireable. I need to use data from a form in my ASP code which causes some problems w/ client/server issues when I use javascript. What I would like to do is resize/set attributes of a page that I post to.

If it is helpful here is the code that I use to open the window:
function whereWindow(myForm, myavailable, sURL, sName, w, h) {

choiceForm = document.getElementById(myForm);
available = document.getElementById(myavailable);

var selectedItem = choiceForm.available.selectedIndex;
var selectedText = choiceForm.available.options[selectedItem].text;
var selectedValue = choiceForm.available.options[selectedItem].value;
var selectedClass = choiceForm.available.options[selectedItem].myvalue;

// your new window's width
var w = w || 640;
// your new window's height
var h = h || 480;
var sName = sName || ("win" + new Date().getTime());

var ah = window.screen.availHeight;
var aw = window.screen.availWidth;
var l = (aw/2) - (w/2);
var t = (ah/2) - (h/2);
var sAtts = "location=no" +
",menubar=no" +
",resizable=yes" +
",scrollbars=yes" +
",status=yes" +
",toolbar=no" +
",height=" + h +
",width=" + w +
",top=" + t +
",left=" + l;
sURL = sURL + "sel="+selectedText+"&type="+selectedClass;
window.newWin = window.open(sURL, sName, sAtts);


}
I would like to apply all these attributes to a window that I open using a post.
Any suggestions would be appreciated! Thanks!
 
Can you check for this on the onLoad event of the parent page when posting back. If you are posting back, then possibly resize that window using your javascript? Just a thought.


regards,
Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top