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!

Syntax problem passing a parameter

Status
Not open for further replies.

Boblevien

Technical User
Nov 3, 2000
38
GB
I have a number of <input> boxes named text1, text2 and a couple of <iframes> named strTextRichText1 & 2 and I want to use the following function to fill the input boxes.
<code>
function output(N)
{
document.forms[0][(&quot;text&quot; + N)].value=[(&quot;strTextRichText&quot;+N)].document.body.innerHTML;
}
</code>
The first substitution works fine
<code>
document.forms[0][(&quot;text&quot; + N)].value
</code>
but not the next time:
<code>
[(&quot;strTextRichText&quot;+N)].document.body.innerHTML;&quot;
</code>
What am I doing wrong?

Bob Levien
 
Maybe -

Code:
eval(strTextRichText + N + &quot;.document.body.innerHTML&quot;);
 
You can also use the form.elements array.
<bb>
 
rac2 - Hi, I've tried that and it works just fine, so thanks.

activeX - Hi, sounds interesting - could you just expand on that a tad?

Thanks both.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top