Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Don't see the error here

Reply
Thread Tools

Don't see the error here

 
 
Fetty
Guest
Posts: n/a
 
      04-11-2005
<script language="JavaScript">
function copyComment(fieldNameVal,fieldTextVal){
eval("document.Forms[0]." + fieldNameVal + ".value =" + fieldTextVal)
}
</Script>

 
Reply With Quote
 
 
 
 
Lee
Guest
Posts: n/a
 
      04-11-2005
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>

 
Reply With Quote
 
 
 
 
Rob B
Guest
Posts: n/a
 
      04-11-2005

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

Never mind, junk the whole thing....

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


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Grant Wagner
Guest
Posts: n/a
 
      04-11-2005
"Fetty" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> <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>

--
Grant Wagner <(E-Mail Removed)>
comp.lang.javascript FAQ - http://jibbering.com/faq


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Can anyone here see the error at the URL shown? TIA why? Computer Support 1 09-16-2009 05:19 PM
Re: Can anyone here see the error at the URL shown? TIA why? Computer Support 2 09-16-2009 05:06 PM
Re: Can anyone here see the error at the URL shown? TIA NormanM Computer Support 1 09-16-2009 03:08 AM
Re: Can anyone here see the error at the URL shown? TIA why? Computer Support 0 09-15-2009 08:21 PM
Can you see why I'm getting a NoClassDefFoundError here? I can't see it :< Flip Java 3 02-09-2004 10:13 PM



Advertisments