473,395 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

MS DOM and style and class

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
Dec 15 '06 #1
4 2378
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/
Dec 15 '06 #2
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

"Randy Webb" <Hi************@aol.comwrote in message
news:Xv********************@telcove.net...
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/

Dec 15 '06 #3
VK

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-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';

Dec 15 '06 #4
tr.style.fontSize = 'xx-small';

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

Aaron
Dec 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: David MacQuigg | last post by:
I have what looks like a bug trying to generate new style classes with a factory function. class Animal(object): pass class Mammal(Animal): pass def newAnimal(bases=(Animal,), dict={}):...
13
by: arreeess | last post by:
i wont used three styles in the element of a list; i have does so: <ul> <li> ............................. </li> first style <li> <p> .....................</p> </li> 2° style <li> <p...
9
by: lkrubner | last post by:
How do I get all the div's on a page? I realize in IE I can use document.all. For the other browsers, I need to get an array of all the divs on the page. getElementByTagName()?????
3
by: Kalle Anke | last post by:
I'm confused by the concepts of old-style vs new-style classes, I've read most of the documents I found about this but it doesn't "click". Probably because I wasn't around before 2.2. Anyway,...
38
by: looping | last post by:
For Python developers around. >From Python 2.5 doc: The list of base classes in a class definition can now be empty. As an example, this is now legal: class C(): pass nice but why this...
1
by: Armin Gajda | last post by:
Hi, I have the following problem: An input field get a border assigned by a style class (e.g. 2px solid red). When the field gets the focus, we set the border to green. element.style.border...
13
by: stephenpas | last post by:
We are trying to monkey-patch a third-party library that mixes new and old-style classes with multiple inheritance. In so doing we have uncovered some unexpected behaviour: <quote> class Foo:...
3
by: Michellevt | last post by:
Hi I am working on a project (for college) and wondered if anyone can help me with my problem. In the project we are not allowed to make use of any "style" attributes but "class" attributes...
5
by: Nathan Sokalski | last post by:
I have css that would normally be placed in style tags in the header of the Master page that I want to add programmatically for a specific Web Content Form (the *.aspx page). How do I do this for a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.