|
|
Subject:
Using Illegal Identifiers in a JavaScript function
Category: Computers > Programming Asked by: gr8fuljeff-ga List Price: $10.00 |
Posted:
05 Jan 2005 19:59 PST
Expires: 06 Jan 2005 13:21 PST Question ID: 452750 |
Is it in any way possible to use what is typically considered an illegal identifier in a JavaScript function-- for instance, to use an identifier that starts with a number, or contains a dash or other special character? For example, one of the things I need to manipulate is part of a form. It could be referenced like this (obviously an example): document.formName.illegal-identifier.value = ?7?; (OR) document.formName.7illegalidentifier.value= ?7?; How would I go about referencing the variable ?illegal-identifier? from a JavaScript function? If this is not possible, is there an easy way around my problem, assuming the name of the object I am trying to reference can not be changed? |
|
There is no answer at this time. |
|
Subject:
Re: Using Illegal Identifiers in a JavaScript function
From: kwik-ga on 06 Jan 2005 03:56 PST |
Hi, I don't think it is possible to reference a form with an illegal identifier. I'm not sure if i understand your question. If i understand correct, you want to be able to manipulate a form but you have no way to do this, because the identifier is illegal. In that case you might try to use the forms id. In the example below the id of <h1> is used, but you can do the same with a form. <html> <body> <h1 id="box1">test</h3> <script> document.getElementById("box1").style.backgroundColor = "#ff0000"; </script> </body> </html> Is this what you where looking for? Just let me know if you need more information. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |