Connecting Tech Pros Worldwide Help | Site Map

add a method to object HTMLCollection

 
LinkBack Thread Tools Search this Thread
  #1  
Old May 10th, 2006, 10:25 PM
Grzegorz ¦lusarek
Guest
 
Posts: n/a
Default add a method to object HTMLCollection

Hi all. Is it posible to add a method to prototype of object HTMLCollection?
I mean something like this:
HTMLCollection.prototype.indexOf=function(obj){
var result=-1;
for (var i=0;i<this.length;i++){
if (this[i]==obj){
result=i;
break;
}
}
return result;
}

my trials fail for now but I will try more
thanks for any help
Gregor

  #2  
Old May 18th, 2006, 12:45 PM
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
Default Re: add a method to object HTMLCollection

Grzegorz Ĺšlusarek wrote:
[color=blue]
> Hi all. Is it posible to add a method to prototype of object
> HTMLCollection?
> I mean something like this:
> HTMLCollection.prototype.indexOf=function(obj){
> var result=-1;
> for (var i=0;i<this.length;i++){
> if (this[i]==obj){
> result=i;
> break;
> }
> }
> return result;
> }[/color]

Yes, it is, in the Gecko DOM. However, this does not have an effect on
DOM collections like document.forms or those retrieved with
document.getElementsByTagName() etc. yet: the respective objects do not
inherit from HTMLCollection. It does work for HTMLOptionsCollection,
though.
[color=blue]
> my trials fail for now[/color]

"Does not work" is a useless error description. [psf 4.11]

<URL:http://jibbering.com/faq/#FAQ4_43>


PointedEars
--
What one man can invent another can discover.
-- Sherlock Holmes in Sir Arthur Conan Doyle's
"The Adventure of the Dancing Men"
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.