----- Original Message -----
Sent: Monday, June 11, 2001 4:36 PM
Subject: Re: [Dynapi-Dev] Extending
native objects
the following is from some code that I included in ym api for
some reason, don't really use it that much.
String.prototype.trim=function(side) {
var tmp=this.toString();
if (side!="right")
tmp=tmp.replace(/^\s+/, "");
if (side!="left")
tmp=tmp.replace(/\s+$/, "");
return tmp;
};
String.prototype.isDate=function() { return
Date.parse(this); };
String.prototype.wordCount=function() {
return this.split(" ").length; };
It all works is all the browsers that I have tried. It is possible
that this is not the same for all browser objects.
"B�rge, Michael" wrote:
is there a way in IE to extend a browserdefined
object?
i tried to do something like this:
MyImage = function() {
this.superClass = Image;
this.superClass();
}
MyImage.prototype = new Image;
..but it
didn't inherit anything.
The following also doesn't work:
Image.prototype.somemethod = function()
{ somecode }
I came to the
conclusion that native constructors in ie do not have a
prototype
property.
So if somebody tells me this sort of thing isn't possible: fine, i won't
spend any more time on it.
If it is possible: please tell me how!
--
Michael Buerge
_______________________________________________
Dynapi-Dev mailing
list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev
--
Michael Pemberton
[EMAIL PROTECTED]
ICQ: 12107010