xx********@supergambler.com wrote:
I'm trying to set the class of a newly created object
I've tried the following two statements...
imgf.class = "classname";
imgf.style.class = "classname";
This doesn't seem to work, it causes a JavaScript error message......
"a JavaScript error message" is as bad an error description as any.
do you know the correct syntax?
<FAQENTRY>
Since `class' is a reserved word in several interfacing languages,
including JS/ECMAScript, it cannot be used for identifiers which is
why the DOM Level 2 HTML ECMAScript binding specifies the `class'
attribute of HTML elements to be accessible through the implemented
`className' attribute of HTMLElement objects.
imgf.className = "classname";
See <http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-213157251>.
</FAQENTRY>
BTW, that is a FAQ here; not covered by the FAQ list[1] yet, however it can
be searched through (Google Groups) archives which is the first thing one
should do before posting.
<http://jibbering.com/faq/#FAQ2_11>
PointedEars
___________
[1] <http://jibbering.com/faq/>