Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HTMLDivElement has no properties in IE6 (?)

    I am trying to use the function below in a tree-menu to toggle the visibility of child buttons via their style object. However, even though I get a list of divs back, all of which test OK as HTMLDivElement objects, I get an error in IE6 (SP2) whenever I try to access any of the properties (even length and toString() ) saying the property is not supported.

    It all works fins in Opera and Mozilla.

    Code:

    var list = document.getElementsByTagName('div');
    for(a=0; a<list.length; a++)
    if(HTMLDivElement.prototype.isPrototypeOf(list.a))
    alert(list.a.className); // Falls over here
    else alert('list.'+a+' is NOT an HTMLDivElement type object');


    Any ideas?

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I seem to recall that elements have no prototype in IE... have you checked the documentation?
    *this message will self destruct in n-seconds*

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's right - HTMLElement prototyping isn't supported in IE
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    DOM objects in ie are COM components. They don't even follow the JScript rules, much less the ECMAScript or DOM rules. (They do follow VBScript, VBA and VB6 rules rather strictly, though.)
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •