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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i refer a table from a new window ?

Status
Not open for further replies.

miks

MIS
Sep 27, 2002
13
CH
how can i refer a dynamically created table named 'listTable2' from a new opened window named 'win' using the function moveToElementText() function?...i will put the table in Excel...I can refer with 'listTable' but not with 'listTable2'...below are the codes...
Pls help me!...i need the answer immediately...THANXS!

<html>
<head>
<title>Printing With Excel</title>
</head>
<body bgcolor=&quot;#FFFFFF&quot;>
<form>
<table name=&quot;listTable&quot; id=&quot;listTable&quot; width=&quot;98%&quot; border=&quot;0&quot;>
<tr>
<td colspan=&quot;3&quot;>
<div align=&quot;center&quot;><b>MAINTAIN CLIENT</b></div>
</td>
</tr>
<tr>
<td width=&quot;14%&quot;> </td>
<td width=&quot;62%&quot;> </td>
<td width=&quot;24%&quot;> </td>
</tr>
<tr>
<td width=&quot;14%&quot;><b>Client No.</b></td>
<td width=&quot;62%&quot;><b>
<input type=&quot;text&quot; name=&quot;text1&quot; size=&quot;15&quot;>
</b></td>
<td width=&quot;24%&quot;><b> </b></td>
</tr>
<tr>
<td width=&quot;14%&quot;><b>Client Name</b></td>
<td width=&quot;62%&quot;><b>
<input type=&quot;text&quot; name=&quot;text2&quot; size=&quot;40&quot;>
</b></td>
</tr>
</table>
<input type=button value=Print onClick=&quot;rewrite(this.form)&quot;>
</form>

<script language=&quot;javascript&quot;>
function rewrite(a){
win=window.open('','win','width=500,height=300,statusbar=0,menubar=0,title=0,status=0')
win.document.writeln('<html><head><title></title></head>')
win.document.writeln('<body bgcolor=white>')
win.document.writeln('<font color=red></font>')
win.document.writeln('<form name=&quot;f&quot;>')
win.document.writeln('<table name=&quot;listTable2&quot; id=&quot;listTable2&quot; width=&quot;98%&quot; border=&quot;0&quot;>')
win.document.writeln('<tr>')
win.document.writeln('<td colspan=&quot;3&quot;>')
win.document.writeln('<div align=&quot;center&quot;><b>MAINTAIN CLIENT</b></div>')
win.document.writeln('</td>')
win.document.writeln('</tr>')
win.document.writeln('<tr>')
win.document.writeln('<td width=&quot;25%&quot;><b>Client No.:</b></td>')
win.document.writeln('<td width=&quot;70%&quot;><b>')
win.document.writeln(a.text1.value)
win.document.writeln('</b></td>')
win.document.writeln('<td width=&quot;24%&quot;><b> </b></td>')
win.document.writeln('</tr>')
win.document.writeln('<tr>')
win.document.writeln('<td width=&quot;25%&quot;><b>Client Name:</b></td>')
win.document.writeln('<td width=&quot;70%&quot;><b>')
win.document.writeln(a.text2.value)
win.document.writeln('</b></td>')
win.document.writeln('</tr>')
win.document.writeln('</table>')
win.document.writeln('</form>')
win.document.writeln('</body></html>')

textRange = document.body.createTextRange();
textRange.moveToElementText(listTable);
textRange.execCommand(&quot;Copy&quot;);
window.open('outputFile.xls','printing');
}
</script>
</body>
</html>



 
hi
try win.document.all.listTable2 - this is a reference 2 the table in the window defined as win
sorry, have no idea about moveToElementText()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top