473,943 Members | 25,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getAttribute('s tyle') not working in IE

CES


All,

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.getEle mentById('test' ).innerHTML = document.getEle mentById('id_Co mpanyName').get Attribute('styl e');
<div class="dR4C2">
<p id="id_CompanyN ame" style="font-size:<%=aspName FontSize%>px;">
<%=aspCompanyNa me%>
</p>
</div>

It seems to be a problem with the getAttribute('s tyle') portion of the code because if I change the request to getAttribute('i d') it executes properly. If someone could look at this an give me some hint as to why it isn't working in IE I be great full Thanks in advance. - CES
Nov 24 '05 #1
2 12329
VK
<html>
<head>
<title>tmp</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript">
function test() {
var s =
document.getEle mentById('id_Co mpanyName').get Attribute('styl e');
if (typeof s == 'string') {
alert(s);
}
else if (typeof s == 'object') {
alert(s.cssText );
}
else {
var mes = 'What you call \"my browser\" is not a browser.\n';
mes+= 'Do you want a normal browser?';
if (confirm(mes)) {
window.location .href = 'http://www.mozilla.org ';
}
}
}
</script>
</head>

<body bgcolor="#FFFFF F" onload="test()" >
<div class="dR4C2">
<p id="id_CompanyN ame" style="font-size:10px;">&nb sp;</p>
</div>
</body>
</html>

:-)

Whatch the case! For further development convenience Mozilla brings
everything to the lower case and IE to the upper case.

Nov 24 '05 #2
CES
VK wrote:
<html>
<head>
<title>tmp</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript">
function test() {
var s =
document.getEle mentById('id_Co mpanyName').get Attribute('styl e');
if (typeof s == 'string') {
alert(s);
}
else if (typeof s == 'object') {
alert(s.cssText );
}
else {
var mes = 'What you call \"my browser\" is not a browser.\n';
mes+= 'Do you want a normal browser?';
if (confirm(mes)) {
window.location .href = 'http://www.mozilla.org ';
}
}
}
</script>
</head>

<body bgcolor="#FFFFF F" onload="test()" >
<div class="dR4C2">
<p id="id_CompanyN ame" style="font-size:10px;">&nb sp;</p>
</div>
</body>
</html>

:-)

Whatch the case! For further development convenience Mozilla brings
everything to the lower case and IE to the upper case.


VK,

Thanks for the help... - CES
Nov 24 '05 #3

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

Similar topics

2
5475
by: CES | last post by:
All, I'm at a loss, the code below works in IE but not in Netscape and I'm unskilled enough not to know why. Essentially this code looks thru all of the form fields and if the input box has a attribute of disabled="true", attribute would only be present if the field was disabled, then the label field's class is changed to a grayed out color. --- The first problem seems to be with the v==true statement, I've tried
12
3112
by: relaxedrob | last post by:
Hi All! I have a page with with the following style information: <link rel="stylesheet" type="text/css" href="/eEmployment/eTech.css" /> <style type="text/css"> DIV.Application { BACKGROUND-IMAGE:url(/someImage.jpg); }
3
21938
by: hutch | last post by:
Hi, I'm making use of this VERY useful function for a so called 'standards compliant' replacement for target="_blank": function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { var anchor = anchors;
5
1388
by: verrice | last post by:
Hello, I'm writing a web application where I want to load bits of data at runtime from the client end (via AJAX). The loading of the data part works great, but for some reason anytime I try to impart a style setting (via either putting it inline, a CSS, or through javascript) the DIV completely ignores my setting. The setting most importantly I'm trying to apply is display: none, but none of them work. If I pre-create everything...
7
1933
by: T J Rogers | last post by:
Hi folks, Below is a script that I use on a site to detect the size of the browser window then automatically load an alternative stile sheet when appropriate. Its a bit clumsy, and I don't like using js but the the brief demanded a solution. Now the only difference between the two style sheets is one line:
2
6532
by: emma.sax | last post by:
Hi 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++) { alert(lnks.getAttribute("class"));
0
1634
by: sandy | last post by:
I have a AxWebBrowser class. I wish to locate a specific element in its HTMLDocument which has a specific 'style'. I use the following code to access the element with the specific style:- IHTMLDocument2 doc = (HTMLDocumentClass)Browser1.Document; if( doc.body != null && doc.body.all != null) { foreach(IHTMLElement el in (IHTMLElementCollection)doc.body.all)
6
6196
by: vivekian | last post by:
Hi , In one of the javascript functions , i need to get the ids of the elements. This function works in Internet Explorer : var TabNames = ParentTab.childNodes ; for ( i = 0 ; i < TabNames.length ; i++ ) { var TabID = TabNames.getAttribute('id') ;
4
5063
by: ICPooreMan | last post by:
I've got some code which works in firefox that's giving me fits in IE7 (maybe other versions too I haven't tested it). What I want to do is get the oncontextmenu attribute of something, change the value then put it back as the oncontextmenu attribute. Here's an example page if you want to try it out... <html> <head> <titletesting </title> <script><!--
0
11534
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11125
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11299
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
8219
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6308
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4910
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.