Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7604833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:00:42+00:00 2026-05-31T00:00:42+00:00

Basically, I have my DOM objects set up and am calling the .getAttribute method

  • 0

Basically, I have my DOM objects set up and am calling the .getAttribute method on an IMG element that is defined as below:

<IMG style="WIDTH: 134px; HEIGHT: 75px;" src="...">

Assuming hElement is the object reference to above element, when I call the following:

MsgBox hElement.getAttribute("style")

I get the following returned: “WIDTH” only, ie: part including and after the : character is ignored. To add to this, if I do a hElement.getAttribute(“width”) on the IMG element, it returns the actual width as “134” even though I don’t explicitely have a width=”…” attribute defined. So, basically, I am asking, how can I ensure I get back things as they are written, and not as they are reconstructed and stored by IE, as that is what it seems to be doing with the inferred WIDTH attribute. Also, not sure why it is ignoring everything including and after the : character right next to the WIDTH – how can I make this work properly?

Odd thing is, if I do the following, it shows everything as it should be:

hElement.outerHTML

The style attribute’s value is shown as defined above. If I have to parse .outerHTML in order to get correct readings, that is just going to be depressing – I’m really disappointed in MS’s half baked efforts. If you’re looking for something extra to read, feel free to refer to another issue I noted about attributes returning odd behaviour when using capitals and when not (solved through a hack).

I’m using VB6, but it is all just the same, mshtml.dll, I gather, I am using IHTMLElement to define the hElement, not sure if I should be using something else but I think IHTMLElement is good for IE6+…?

UPDATE:

If I declare the hElement as IHTMLElement5 or IHTMLElement6 then it WORKS AS EXPECTED. If I use any of the following, it doesn’t work: IHTMLElement, IHTMLElement2, IHTMLElement3 and IHTMLElement4. Since it only goes up to 6, only 5 & 6 work. It seems as though these are added later for newer versions of IE, and although you don’t see the .getAttribute object in intellisense in 2 and above, you can still use it for some reason (not sure if its based on what IE version is installed). Does anyone know what version of IE IHTMLElement5 and IHTMLElement6 stands for? How can I get consistent behaviour for IE6+ as I don’t have control on what versions are installed on the clients. If I use IHTMLElement5 or IHTMLElement6 does this mean it will not work on IE6 clients?

More:
Turns out IHTMLElement5 is for IE8+ and IHTMLElement6 is for IE9+ – any ideas or recommendations on how to get consistent behaviour for IE6+? Thanks.

UPDATE2: I have added a new question, which spawns from this question, it can be found here for those interested:
What happens when using IHTMLElement5/6 (for IE8/9) in IE6/7? Does it divert to IHTMLElement behaviour?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:00:44+00:00Added an answer on May 31, 2026 at 12:00 am

    You might wanna take a look at this http://robertnyman.com/2006/04/24/get-the-rendered-style-of-an-element/

    SO in your case you should try using the cssText property which will return a string consisting of all the css properties

    hElement.style.cssText
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I basically have a server set up and I'm accepting new clients(UNIX) and i'm
I basically have 7 select statements that I need to have the results output
I basically have to do a update of a record. I have a set
Basically I have a script that updates an xml document in various places... However,
I have some working Javascript that manipulates the some DOM elements. The problem is,
I'm having a bit of a jQuery problem. Basically I have some functions that
I have difficulty in using the vb code dom. Basically, I want to compile
I have some HTML I need to parse. Basically I'm walking through the dom
I read somewhere that objects were basically hash tables, and you could assign values
I have some scripting that modifies my web application. What it basically does is:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.