Click to See Complete Forum and Search --> : writeln in other windows?
Granger9
11-03-2003, 03:26 PM
I have opened a window using javascript with the following code:
window.open('printout.html','prinout','location=no,status=no,height=200,width=300');
I have some information i have in a text area on the main page to be transfered onto the newly opened window. Can this be done and if so how?
Thanks
Dan
fredmv
11-03-2003, 03:35 PM
You would first need to assign the new window to a variable. This way, you can reference the document contained in the new window and read and write information to and from it. Here's how it would be done:var w = window.open('printout. html','prinout','location=no,status=no,height=200,width=300');Now, the variable w has a reference to the document contained in the new window. In this case, printout.html. So, since you have a textarea in the parent document, and you want to transfer it to the child window, you could do this:with( w.window.document )
{
writeln( document.form.textarea.value );
}This is where document.form.textarea.value is a reference to the textarea element in the parent document.
I hope that helps you out. :cool:
Granger9
11-03-2003, 03:40 PM
Thanks.
the printout.html file already has a load of HTML in it and I just want to tag the data in the textarea onto the end of the HTML. As using the method above overwrites whats already in the HTML file.
Thanks again