Document.prototype issue!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • carllucas
    New Member
    • Oct 2006
    • 35

    #1

    Document.prototype issue!

    I'm in the process of creating my own getElementsByCl assName function...

    why does this not work in IE and it does on firefox?

    Code:
    Document.prototype.getElementsByClassName = function(para)
    {
    	alert(para);
    }
    the error i keep getting on IE (7) is:

    object doesn't support this property

    please help.
  • mrhoo
    Contributor
    • Jun 2006
    • 428

    #2
    IE has never yet had a Document constructor.
    No constructor, no prototype.

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      This works in Firefox, but not IE because Mozilla exposes all of the DOM constructors and IE doesn't. In any case, there is only ever one instance of Document, so there's no need to prototype it.

      Comment

      Working...