473,386 Members | 1,738 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,386 software developers and data experts.

IE support of javascript setAttribute('style', ... )

Does internet explorer support the statement
elem.setAttribute('style', ... );, for example:

document.getElementById('ExampleID').setAttribute( 'style', 'width:
10px' );

I can't get that statement to work in IE7, although it works in FF3.

bgold12
Sep 1 '08 #1
2 6689
bgold12 <bg*****@gmail.comwrites:
Does internet explorer support the statement
elem.setAttribute('style', ... );, for example:
That would be a confusing statement: does it completely replace all
current styles or what? Note that FF (at least FF 2) does not allow
you to replace the style, so elem.style = ... will throw an error.

You probably want just elem.style.backgroundColor= ... and equivalent
instead.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Sep 1 '08 #2
On Sep 1, 2:46*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
bgold12 <bgol...@gmail.comwrites:
Does internet explorer support the statement
elem.setAttribute('style', ... );, for example:

That would be a confusing statement: does it completely replace all
current styles or what? Note that FF (at least FF 2) does not allow
you to replace the style, so elem.style = ... will throw an error.
I disagree. Firefox has support for both forms of *style*
manipulation.
You can change the object's complete style description using the
setAttribute(attrName, attrValue) method. But, for the sake of browser
compatibility what you suggested below is more apt.
You probably want just elem.style.backgroundColor=... and equivalent
instead.
On another note, Firefox has another way of manipulating attributes
which
is a bit daunting. I was so hoping that IE had it. But 6 and 7 don't
support proper attribute manipulation I might say.

document.getElementById(id).attributes.item("style ").nodeValue =
"color:red";

IE8x, I hope would resolve these issues.

Arun
Sep 1 '08 #3

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

Similar topics

10
by: kaeli | last post by:
Is it just me, or does obj.setAttribute("style","border: thin solid navy"); (for example - no style seems to be set) not work in IE6 but works fine in NN6? I don't want to use element.style...
5
by: Ben | last post by:
I have a form for data entry which is in a table. I have a select box to enter a customer name, which takes it's options from the customer database. I have a button to add a new customer. What I...
4
by: Kenneth McDonald | last post by:
I'm curious about this because, quite aside their function as web browsers, it is now possible to build some very useable interfaces using browsers with HTML, CSS, and JavaScript. (The biggest...
0
by: Nabani Silva | last post by:
Hi, hope someone can help me I'm getting this exception: System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean...
3
by: Joe Cox | last post by:
I am having a problem with style properties for dynamic images in Mac OS X Safari. By dymanic images, I mean images allocated with the javascript 'new Image()' call. With static images (created...
1
by: ryezack | last post by:
i have an image map with an onmouseover event thats calls a javascript function style cursor is hand. this works in IE but not in firefox. here's the code: <script type="text/javascript"> <!--...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
2
by: murderof1 | last post by:
Hello, I'm new to Javascript, but I'm trying to create html tables based off a checkbox action. Is it possible to do this on the same page? I've noticed that document.write() will create the...
3
by: Ellie | last post by:
This is the error that my vb.net 2.0 program is throwing. The debugger is saying it is coming from ntdll.dll. I'm not sure what this means since the program is running fine on 3 other machines. Any...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.