golfboy
04-16-2003, 04:02 PM
I have written a function that opens a new window and then fills in a couple of form fields in that new window. The code works fine when I test it on my computer, however when the pages are uploaded to the internet the code no longer works. I get an error that the form I am referring to does not exist. I believe the problem to have something to do with the new window not being completely loaded. If I add any kind of alert() in the code after the window is opened but before the form fields are to be filled in, the code works fine. Is there anyway to pause the code until the new window is completely loaded? Or a way to tell when the new window is completely loaded? Or am I totally off in what I think is wrong?
Any help would be much appreciated. Here is the function:
function fillInTheForm(bagname, price, the_url) {
var height = window.screen.availHeight;
var width = window.screen.availWidth;
var left_point = parseInt(width/10);
var top_point = parseInt(height/30);
var new_window=window.open(the_url, "new_window", "width=680,height=400,scrollbars,toolbar,menubar,resizable");
new_window.focus();
new_window.moveTo(left_point,top_point);
new_window.document.forms[0].bag_desc.value = bagname;
new_window.document.forms[0].price.value = price;
}
Any help would be much appreciated. Here is the function:
function fillInTheForm(bagname, price, the_url) {
var height = window.screen.availHeight;
var width = window.screen.availWidth;
var left_point = parseInt(width/10);
var top_point = parseInt(height/30);
var new_window=window.open(the_url, "new_window", "width=680,height=400,scrollbars,toolbar,menubar,resizable");
new_window.focus();
new_window.moveTo(left_point,top_point);
new_window.document.forms[0].bag_desc.value = bagname;
new_window.document.forms[0].price.value = price;
}