Click to See Complete Forum and Search --> : Prototyping new functions


Padrill
06-27-2003, 06:30 AM
Hi all,

I have an external .js file and in it I'm trying to assign a new function (isButton()) to the Input object but I get the error: 'Input is not defined'. Can anyone tell me what I'm doing wrong?

Thanx

PS. I using this code:

Input.prototype.isButton = function () {

return (this.type == "button" || this.type == "submit" || this.type == "reset");
}

Charles
06-27-2003, 06:40 AM
Form elements are objects but they do not appear to belong to any class, hence they defy any attempt to give them class methods.

Padrill
06-27-2003, 06:48 AM
How can an object not be instantiated from a Class? This doesn't make sense.