Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    JavaScript


GetAttribute('style') Not Working In IE

I'm 2 for 2 on stupid questions this works in FireFox but not in IE it's not returning the value of the style element and I'm getting [object] error??

document.getElementById('test').innerHTML = document.getElementById('id_CompanyName').getAttri bute('style');

<div class="dR4C2">
<p id="id_CompanyName" style="font-size:<%=aspNameFontSize%>px;">

It seems to be a problem with the getAttribute('style') portion of the code because if I change the request to getAttribute('id') it executes properly....

View 2 Replies (Posted: November 24th, 2005)

Sponsored Links:

Related Forum Messages For JavaScript category:
Which Format To Use For Setting An Attribute - GetAttribute Isn't Working?
I am trying to get my script working in FF, IE and Opera but the getAttribute isn't working for me. The domain name isn't getting picked up I have tried this:


Posted: 01-22-2011, 03:28 PM

View 2 Replies!   View Related
GetAttribute() In IE
I have the following code which is working in Firefox:

function showOptions() {
if(!document.getElementById) return false;
if(!document.getElementsByTagName) return false;
var lnks = document.getElementsByTagName("a");
for(var i=0; i<lnks.length; i++) {
if(lnks[i].getAttribute("class") == "toggle") {
lnks[i].onclick = function() {
var options = document.getElementById("multiretailers");"block";

I understand that IE doesn't like he getAttribute() method and is
returning null for the class name.

What are the work arounds for this?

Posted: June 23rd, 2006

View 2 Replies!   View Related
GetAttribute Isn't Getting The Attribute
I'm trying to get the value of an object's property. getAttribute returns "null" even though I'm sure the property is set. I can easily set the property, and in my actual script I do so dynamically. I just want to read the property and can't.

To help explain my problem, I've attached an example .html file as a .txt file.

The critical part of the code is this section that is based on "textbook" examples of how to get an attribute:

<script type="text/javascript">
showcolor() {
var myobject = document.getElementById("lab");
var myproperty = myobject.getAttribute("color");


This is called via a button on the bottom of the page. The DIV object with the ID "lab" exists and has a color attribute defined in CSS, but I cannot read it, nor any other attribute, with a script. The alert displays "null".

Posted: 03-29-2007, 01:10 AM

View 8 Replies!   View Related
AJAX :: GetAttribute Is Not A Funcation
During development of Bing Maps, I've come across a problem when reading in an XML file and plotting a ploygon. The code works fine on IE, but FireFox is giving me the following error message: Error: xNodes[i].getAttribute is not a function

The function in its entirety is copied below and the problem line is marked in red. Hoping that someone may have come across this problem?


Posted: 04-19-2011, 07:29 AM

View 2 Replies!   View Related
Xmldom GetAttribute Firefox Problem
I am trying to get a url attribute from an xml node:
<media url="" />

I can do this in IE with the following code:
var newDom = xmlhttp.responseXML;
var x = newDom.getElementsByTagName("item");
var urlNode = x[0].getElementsByTagName('media');
var myUrl = urlNode[0].getAttribute('url');

If I try this code in FireFox it gives me the following error:

urlNode[0] has no properties referring to this line : myUrl =


Posted: October 17th, 2007

View 3 Replies!   View Related
GetAttribute Won't Get A Display Attribute / Solution For This?
I want to find out if an element has been hidden by setting display to 'none'.

When it has been hidden, I find "display: 'none'" in the firebug display, as expected. code...

Posted: Oct 29, 2009

View 6 Replies!   View Related
Bug In Internet Explorer 7 Element.getAttribute Method?
I'm implementing a length counter on textareas for a website (twitter style). I'm using the code found herehttp:[url].... but seems not to work in IE7.I've traced the issue to the check of the attribute "maxlength" in an element.It expects it to be null if the attribute is not found, but IE7 returns a number (which I guess is the maximum length allowed by the browser or by the HTML standard, I don't know).Here's an example you can try:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="es" lang="es">[code]....

Try executing this on IE7 and you'll find out it gives a number instead of null.Exact version of IE7 is 7.0.5703.13.Should I consider this a IE7 bug or is it working as expected?

Posted: Jul 20 11 at 12:01

View 1 Replies!   View Related
Error On GetAttribute While Parsing An Xml Document In Internet Explorer
I'm calling a webservice from javascript and then parsing the xml and rendering tables. All is well in firefox, but in IE its a different story. The problem seems to be on this this line

var count = result.childNodes[0].getAttribute('Count'); Is there an IE friendly way to get an xml attribute in javascript? the rest of the code works fine. but unfortunately i need that count.

Posted: Sep 3 09 at 16:17

View 1 Replies!   View Related
JQuery :: Css - DataTables On Intranet Site - GetAttribute('class') Returns Null?
I am working on an intranet web application using dataTables 1.8.2.The problem appears to occur only in IE9 when it loads the Browser Mode as IE9 Compat View / Document Mode IE7.

This happens because by default, IE9 applies this setup to intranet / local sites. I have no idea why.When using fnSettings().aoData[0].nTr.getAttribute('class'), null is returned. When Document Mode is set to IE8 standards or above, it returns the correct class.Interestingly, if I try using getAttribute('id'), the correct ID is returned.

How can I get / set the class of a given row within aoData when IE9 is in this compatibility mode?An example of my problem is at [URL] (Use IE9's F12 Developer tools to set IE9 Compat / IE7 Standards)

Posted: Nov 25 11 at 12:59

View 1 Replies!   View Related Not Working
I have a html element which has absolute position.


Now in javascript i am trying to move its position attached with onclick

I have even tried:

My browser is Firefox3.3.

Posted: August 4th, 2009, 07:26 AM

View 1 Replies!   View Related Not Working
I want to take the current location of an position:absolute div and add 100 to its value. However I can't get that value, I can set it but not retrieve its current value. Here is a sample.... Code: function moveit(elem){ alert(; alert(document.getElementById("question1"); } Demo: [URL]

Posted: October 1st, 2009, 11:17 AM

View 2 Replies!   View Related
CSS Style.display Not Working
I have the following JavaScript function to display/hide a table row based on a listbox selection.

Following is the listbox.

This is working fine on the listbox onchange event. i.e. the table row is getting hidden and displayed.

But when I try to call the JS function clock_Type() from another function, as shown below, the table row is not getting displayed.

When I traced the code the execution reaches the following section for FireFox

But the table row is not getting displayed.

Posted: Feb 5 10 at 11:53

View 2 Replies!   View Related
Style Changer Not Working?
on my site, I have added Style 1 and Style 2 in my menu at the top right I click on Theme 2, it doesn't work?!I have this working on my other site:

Posted: 03-08-2011, 02:47 AM

View 1 Replies!   View Related
-> Style.visibility Not Working In IExplorer ??? <-
I have a strange problem using Internet Explorer.
My page has a table included in a <DIV>
I have a checkbox that shows the div when checked
and hides it when unchecked.

var division = document.getElementById("passport") ;

Then I use = "visible" ;
or = "hidden" ;

Everything works perfectly under FireFox or Safari showing or
hidding the table.

BUT, in IExplorer 6 or 7, just checking the checkbox doesn't
change anything. You have to first click on the actual division
position to make it appear. Same for unchecking: click on the
displayed table and it will disappear. Code:

Posted: December 5th, 2006

View 2 Replies!   View Related
Working With Attributes
I'm developing a web-template editor for a client, and they want it to update the changes in real-time using javascript. So, in other words, when a person selects a different background image, I use:"url("+bgimg+")";
Well, I've run into a little problem. I can't seem to find any manual on what comes after style.*

So far, I've seen style.color, style.backgroundImage, style.backgroundRepeat, style.backgroundColor. But, I'm looking for something that can control text-decoration, font-weight and a:hover

Does anyone no where I can find a list of all properties support after style.*?

Posted: Nov 1, 2005, 16:40

View 3 Replies!   View Related
Style.cursor='hand' In FireFox Not Working??
This is pretty straight forward... I want to change the cursor to the hand on a mouse event. This works just fine, if I use other cursors, but for some reason I can't get the cursor:hand to work in Firefox???

<div class="showHideDiv" onmouseover="'hand'" onclick="showHideDiv('Price')">Price</div>

Posted: February 6th, 2006

View 19 Replies!   View Related Is Not Working
Through an onClick() event, I have an inline function to change the
font size of the page (actually, I need to do this for the entire
website). I have this defined in the header.cfm file as:


This does not work at all for some reason. Whereas,


works. I am not able to understand why this is happening.

Posted: May 29th, 2007

View 4 Replies!   View Related
Style Opacity Not Working In Internet Explorer
Document.getElementById(fadeImageID).style.opacity is working in firefox but its not working in IE.

Posted: Nov 6th, 2009

View 2 Replies!   View Related
Jquery :: Style For <select> Not Working In Same Way In All Browser?
This is HTML

<div class="DatetimePanel">
<select class="DaysList">
<option value="1">1</option>


Posted: Jul 10 10 at 8:43

View 2 Replies!   View Related
Font Selector Style Css Class Not Working In IE?
I am having a style class for font tag, If size of the attribute is 1. I am setting the following style.
font[size = 1]

font-size : small;
It works in FF , chrome but not in IE

Can anyone explain how to make that work in IE?

Posted: Mar 17 11 at 12:36

View 4 Replies!   View Related
IE / Firefox Style Update Via Script Not Working - Solve This?
I have a program that takes a name from an auto-complete and sends it to a javascript function that dynamically creates a Label with a button inside it. When I try to use the DOM methods to set style properties, it doesn't work in Firefox/IE 7, but it does in IE 8/Chrome. [code]...

The input parameter "client" is the name. It should append the button to the label, then append the label to myData, which is a div inside of a table.

Posted: Jul 13 11 at 15:35

View 2 Replies!   View Related
Cross Browser - IE Setting Style.left Not Working?
I'm struggling setting a style attribute to a div that's created via javascript.The flow is:The script loadsIt creates a <div id="test">It sets attribute style="top: 20px; left: 10px; margin: 0px; position: absolute;"Everything works fine with all other browsers but when it comes to IE things just don't work.How can I set those style attributes in IE ? So far with this code:

var div = document.getElementById('test'); = "10px"; = "20px";


Posted: May 9 11 at 15:07

View 4 Replies!   View Related
JQuery :: Why Remove Throwing .attr Exception In IE8 - "Object Doesn't Support Property Or Method 'getAttribute'"
I have code like this:

_removeSelection : function(e, refocus) {
var thisObj =,
lineItem = $(this).closest('li'),
templateData ='templateData');

Everything logs fine and it appears to execute fine. However after all my code runs I get an exception: "Object doesn't support property or method 'getAttribute'" So I have a loop that calls the function X times, but it only runs the function to completion once. EDIT: The loop triggers a click on an element which runs that function. If I manually trigger the click using firebug, it still throws exception EDIT 2: The exception is thrown at line 4550 in jquery-1.6.2.js Doing lineItem[0].parentNode.removeChild( lineItem[0] ); also causes delayed exception. Looks like @zzzz is right about some weird cache cleanup. This only happens when using .trigger('click'), not when actually clicking on the element

Posted: Aug 18 11 at 21:27

View 2 Replies!   View Related
GetAttribute("width") Not Returning Correctly
I'm working on a slider script and it would be just lovely to be able to specify the slider's width in a width attribute on the input that represents it. In the code below, getAttribute("width") is returning 0 in IE, but seems to work fine in firefox. . . .

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<script type="text/javascript">
var curr_slide="";
var ie = (document.all && !window.opera)?1:0;
if (!ie) document.captureEvents(Event.MOUSEMOVE)
var tempX = 0
var tempY = 0
var slide_width=200;
function buildSlider()
var sliders=getElementsByClassName(document,'input','slider');
var len=sliders.length;
for(var i=0;i<len;i++)
var div=document.createElement('div');
var handle=document.createElement('div');
function getSlide(obj)
var s=obj.parentNode;
var lft1=s.offsetLeft;
var lft2=obj.offsetLeft;
var num=(lft2-lft1)-1;
return num;
function getElementsByClassName(oElm, strTagName, strClassName){
var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
strClassName = strClassName.replace(/-/g, "-");
var oRegExp = new RegExp("(^|s)" + strClassName + "(s|$)");
var oElement;
for(var i=0; i<arrElements.length; i++){
oElement = arrElements[i];
return (arrReturnElements)
function getMouseXY(e)
if (ie)
tempX = event.clientX + document.body.scrollLeft
tempY = event.clientY + document.body.scrollTop
tempX = e.pageX
tempY = e.pageY
if(tempX < 0)
tempX = 0
if(tempY < 0)
tempY = 0
var c_obj=curr_slide.parentNode.nextSibling;

else if(n_spot>slide_width)
<style type="text/css">
border-top:solid 1px #10385A;
border-left:solid 1px #FFFFFF;
border-right:solid 1px #FFFFFF;
border-right:solid 1px #FFFFFF;
border-left:solid 1px #FFFFFF;
table tbody tr td
border:solid 1px;
<br />
<form method="post">
<input type="text" alt="100" width="200" class="slider" />
<br />
<input type="text" alt="10" width="100" class="slider" />
<br />
<input type="text" alt="5" width="300" class="slider" />
<br />
<input type="text" alt="1" width="250" class="slider" />
<br />
<input type="text" alt="1000" width="50" class="slider" />
<br />
<input type="text" alt="2" width="500" class="slider" />
<br />

Posted: 10-31-2006, 11:38 PM

View 5 Replies!   View Related
Copyright 2005-08, All rights reserved