This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Function.call prototype issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Function.call prototype issue" Watch "Function.call prototype issue" New topic
Author

Function.call prototype issue

Sanjiv Jivan
Ranch Hand

Joined: Nov 03, 2005
Posts: 52
I was trying to write some OO Javascript where I have some code like

function Base() {}

Base.prototype.foo = function(){
..
}

Child.superclass = Base.prototype;

function Child(){}

Child.prototype.foo = function() {
Child.superclass.foo.call(this);
...
}

The foo() function in Child works on some IE JS versions, however I get a javascript error on some javascript versions stating that the "call" property is not defined in the line " Child.superclass.foo.call(this);"

I tried googling but could not find an definite answers as to which JS version the "call" functionality was introduced. Is there a better/alternate way to call a superclasses method?

Also is there a way to tell which JS version is running? The machine where I'm getting the error is also running IE 6, but seems to have an older JS version installed on it.

Thanks,
Sanjiv
[ June 02, 2006: Message edited by: Sanjiv Jivan ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
call() and apply() should work on IE 5.5 or greater.

I do not have time to look at your code right now to see if there is a problem.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Function.call prototype issue
 
Similar Threads
Html:button is not working in Mozilla?
overriding javascript funtions in another frame
method.call(..) throws "object doesn't support this property" on some browsers
Javascript/Applet problem in certain versions of Safari
Regarding Java Script