MS DOM and style and class

A

Aaron Gray

Hi,

I have written some DOM code to create a table but .setAttribute( "style",
....) and .setAttribute( "class", ...) are not working on IE where they _do_
work on both FF and Opera.

I am using 4.01 transitional.

Could someone give me the lowdown on this and give me an explanation please
:)

I can post a link to a whittled down example if really required.

Aaron
 
R

Randy Webb

Aaron Gray said the following on 12/14/2006 10:59 PM:
Hi,

I have written some DOM code to create a table but .setAttribute( "style",
...) and .setAttribute( "class", ...) are not working on IE where they _do_
work on both FF and Opera.

I am using 4.01 transitional.

Could someone give me the lowdown on this and give me an explanation please
:)

tableRef.style.property
tableRef.className

IE doesn't like setAttribute
 
A

Aaron Gray

No I am refering to DOM. e.g.

var tr = document.createElement("tr");
var td = document.createElement("td");
tr.appendChild(td);

tr.setAttribute( "style", "font-size:xx-small");
thead.appendChild(tr);

The setAttribute only works on FF and Opera not IE.

Aaron
 
V

VK

Aaron said:
No I am refering to DOM. e.g.

var tr = document.createElement("tr");
var td = document.createElement("td");
tr.appendChild(td);

tr.setAttribute( "style", "font-size:xx-small");
thead.appendChild(tr);

See my answer at
<http://groups.google.com/group/comp.lang.javascript/msg/f9a11b90f45d2a3a>

Stop patchning attribute nodes in the document tree instead of
scripting DOM (which is what you want as I can tell).

tr.style.fontSize = 'xx-small';
 
A

Aaron Gray

tr.style.fontSize = 'xx-small';

Nice, thanks alot, thats sorted that onr out at last.

Aaron
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top