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

help in referring table from another window

Status
Not open for further replies.

miks

MIS
Sep 27, 2002
13
0
0
CH
hi guys!
i need help on how to refer table 'listTable2' from window
win using moveToElementText() function...i can do this with table 'listTable' but not with 'listTable2'...below are the codes...any help would be much appreciated...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;>&nbsp;</td>
<td width=&quot;62%&quot;>&nbsp;</td>
<td width=&quot;24%&quot;>&nbsp;</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(win.document.all.listTable2);
textRange.execCommand(&quot;Copy&quot;);
window.open('outputFile.xls','printing');
}
</script>
</body>
</html>

 
hie
sorry, cant tell u about moveToElementText()
but refer might be smth like win.document.all.listTable2

regards, vic
 
tnx but it doesn't work...by the way do you how to output the value of a textfield from another table from within another table...the two tables are defined within the same form...TNX!!!


<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;>&nbsp;</td>
<td width=&quot;62%&quot;>&nbsp;</td>
<td width=&quot;24%&quot;>&nbsp;</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>

<table name=&quot;listTable2&quot; id=&quot;listTable2&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;>&nbsp;</td>
<td width=&quot;62%&quot;>&nbsp;</td>
<td width=&quot;24%&quot;>&nbsp;</td>
</tr>
<tr>
<td width=&quot;14%&quot;><b>Client No.</b></td>
<td width=&quot;62%&quot;><b>
//output value of text1 from listTable
</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>
//output value of text2 from listTable
</b></td>
</tr>
</table>

<input type=button value=Print onClick=&quot;rewrite(this.form)&quot;>
</form>

 
as far as i kno, there's no matter in which table u have ur textbox, the main thing - in wich form; refer:
document.forms.formName.textboxName.value
i bet u knew that..
 
Shouldn't that be either document.formname.textboxname.value or document.forms[formname].textboxname.value?
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top