07-30-2006, 09:42 PM
I've seen two different types of syntaxes when it comes to modifiying elements.
Syntax #1:var element = document.createElement('div');
Syntax #2:var element = document.createElement('div');
element.id = 'menu';
What's the difference? And what are they called?
07-30-2006, 10:28 PM
The first one is using the DOM2 setAttribute method while the second one is using the method that existed before the DOM standard was created (usually referred to as DOM0). Not all browsers support setting all attributes via the setAttribute method yet.
07-30-2006, 11:23 PM
So the second one is more widely supported? And are there any differences speed-wise? What are the pros and cons of each?
07-31-2006, 04:33 AM
Using the first method you can run into several bugs, especially in IE.
I can't think of any cons to using the DOM0 method.
07-31-2006, 09:28 AM
hi everyone.. i am new here and i know you can help me with my problem.
i am thinking of a site where visitors could only enter my main page if they will click the support button which that support button would link to an ad.
can you suggest of a code?
verginette, please, don't cross-post. You have already:
Furthermore, this post here has nothing to do with this thread here.
It's not just a DOM0-method - many of those were standardized as part of DOM2 HTML.
08-02-2006, 10:26 PM
How can I get DOM0 to work with attributes like tabindex?
element.tabindex = '1';
08-02-2006, 10:27 PM
The property is tabIndex, not tabindex.