new window has info from form in parent window

W

woody

i have a form that contains values that i want to be written to a new
printable window on submit...


can anyone help me???


thanks,
woody
 
L

lkrubner

This seems to be working for me.

================================


// 11-28-04 - one thing I hate is when I write a long email using a
service like Hotmail, then
// I hit submit, and then I lose everything I wrote because while I
was writing the email
// I unknowingly lost my internet connection. So now we are
offering this mild protection,
// which is to gather the text of the form and output it to t
separate window.

function openInNewWindowString(windowText) {
var docWindow = window.open('', 'userSubmission',
'width=300,height=300,status=true,scrollbars=true,resizable=true,toolbar=true');
docWindow.document.write(windowText);
docWindow.focus();
return false;
}



function saveYourWork() {
var elem = document.forms[0].elements,
temp = ['<h1>Please save your work!!!<\/h1>'];

for(var i = 0, n = elem.length; i < n; ++i) {
temp[temp.length] = elem.name;
temp[temp.length] = ': ';
temp[temp.length] = elem.value;
temp[temp.length] = '<hr>';
}
openInNewWindowString(temp.join(''));
}
 
W

woody

thanks, i tryed this and this seems easier...

function showIt(){
window.open('print.html')}

<form name="form1" action="javascript:showIt()">
<input type="text" name="monday" size="105" readonly>
<input type="text" name="tuesday" size="105" readonly>

....
</form>

print.html looks like:

<script language="javascript">
document.write(opener.document.form1.monday.value)
</script>

<script language="javascript">
document.write(opener.document.form1.tuesday.value)
</script>


that will show the parent window's value of the form in the child
window (print.html)

thanks all!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top