PDA

View Full Version : Manipulating new window data


bl1nk
12-27-2009, 06:44 AM
I am trying to open a window then edit text field data on that window. I know how to do both, but I cant seem to get them to work together. Here is what I am currently trying

newWindow = window.open(URL);
newWindow.document.form.message.value = "TEXT TEXT";

Any ideas why this is not working?

rnd me
12-28-2009, 05:09 AM
are the two pages on the same site?

bl1nk
12-28-2009, 06:21 AM
Yes. I figured out that if i do
setTimeout("newWindow.document.form.message.value = 'TEXT TEXT'", 1000);

It works at times, but not at others. It depends on how fast the window opens. Is there any way to detect when the window is opened so I dont have to increase the timeout period??

I have tried using:
newWindow = window.open(URL);
newWindow.onload = function () {
newWindow.document.form.message.value = "TEXT TEXT";
}

But that didn't work.

oesxyl
12-28-2009, 08:06 AM
Yes. I figured out that if i do
setTimeout("newWindow.document.form.message.value = 'TEXT TEXT'", 1000);

It works at times, but not at others. It depends on how fast the window opens. Is there any way to detect when the window is opened so I dont have to increase the timeout period??

I have tried using:
newWindow = window.open(URL);
newWindow.onload = function () {
newWindow.document.form.message.value = "TEXT TEXT";
}

But that didn't work.
window.opener ?

http://www.javascriptkit.com/javatutors/remote.shtml

best regards