Don't see the error here

F

Fetty

<script language="JavaScript">
function copyComment(fieldNameVal,fieldTextVal){
eval("document.Forms[0]." + fieldNameVal + ".value =" + fieldTextVal)
}
</Script>
 
L

Lee

Fetty said:
<script language="JavaScript">
function copyComment(fieldNameVal,fieldTextVal){
eval("document.Forms[0]." + fieldNameVal + ".value =" + fieldTextVal)
}
</Script>


1. language="Javascript" is deprecated.
2. Don't use eval() to reference form fields.
3. There is no document.Forms attribute. It's "document.forms".


Try:

<script type="text/javascript">
function copyComment(fieldNameVal,fieldTextVal){
document.forms[0].elements[fieldNameVal].value = fieldTextVal;
}
</script>
 
R

Rob B

eval("document.F<------ try an 'f'

Never mind, junk the whole thing....

document.forms[0].elements[fieldNameVal].value = fieldTextVal;
 
G

Grant Wagner

Fetty said:
<script language="JavaScript">
function copyComment(fieldNameVal,fieldTextVal){
eval("document.Forms[0]." + fieldNameVal + ".value =" + fieldTextVal)
}
</Script>

script tag language attribute deprecated, type attribute required.
eval() not required. JavaScript is case-sensitive and the forms
collection of the document object is lowercase.

<script type="text/javascript">
function copyComment(fieldNameVal, fieldTextVal)
{
document.forms[0].elements[fieldNameVal].value = fieldTextVal;
}
</script>
 

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,764
Messages
2,569,567
Members
45,042
Latest member
icassiem

Latest Threads

Top