Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











METHOD:  Function::callNetscape Only Feature


Function.call(thisArg[, arg1[, arg2[, ...]]])
 
The call method allows you to call a method from another object. This means you only need to write an object once and just apply it to any other objects that make use of it. The following example first creates an object called Car which has three properties. Then a second object is created called HireCar which (beside others) also has those same properties. So, instead of having to rewrite those properties, the HireCar object uses the call method to inherit them from the Car object. Note that that you can assign a different this object when calling an existing function.
 
Code:
function car(make, model, year)
{this.make = make, this.model = model, this.year = year}

 
function hireCar(carNo, make, model, year)
{this.carNo = carNo, car.call(this, make, model, year)}

 
NOTE
 
The call method is very similar to the apply method, but differs in that with call you cannot have the now deprecated arguments array as one of its parameters.

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information