Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > MS DOM and style and class

Reply
Thread Tools

MS DOM and style and class

 
 
Aaron Gray
Guest
Posts: n/a
 
      12-15-2006
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


 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      12-15-2006
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

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
 
 
 
Aaron Gray
Guest
Posts: n/a
 
      12-15-2006
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-sizex-small");
thead.appendChild(tr);

The setAttribute only works on FF and Opera not IE.

Aaron

"Randy Webb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
> --
> Randy
> Chance Favors The Prepared Mind
> comp.lang.javascript FAQ - http://jibbering.com/faq
> Javascript Best Practices -
> http://www.JavascriptToolbox.com/bestpractices/



 
Reply With Quote
 
VK
Guest
Posts: n/a
 
      12-15-2006

Aaron Gray wrote:
> 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-sizex-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';

 
Reply With Quote
 
Aaron Gray
Guest
Posts: n/a
 
      12-16-2006
> tr.style.fontSize = 'xx-small';

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

Aaron


 
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
new-style class or old-style class? Jayden Python 9 09-27-2012 12:30 AM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
Getting DOM element position(style.left and style.top) Amir Hardon Javascript 0 05-31-2004 01:18 AM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM
New style class & Old style class in Python dlo_olb Python 2 06-25-2003 01:46 PM



Advertisments