File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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