EchoEcho.Com Homepage
Web Hosting - As Reliable As It Gets!
   Home > References > JavaScript > Function Object


 Tutorials 
 D-Zine Articles 
 Online Tools 
 Free Resources 
 References 
 Quiz 
 Hosting 

















  JavaScript Objects :
FUNCTION OBJECT








Core ObjectNNIEECMA
 Function Creates a new function.2+4+ECMA 1
 
MethodsNNIEECMA
 apply() Applies a method of another object to the current object.4+5.5+n/a
 call() Executes method of another object on current object.4+5.5+n/a
 toSource() String representing the source code of the function.4+n/an/a
 toString() String representing the source code of the function.2+4+ECMA 1
 valueOf() String representing the source code of the function.2+4+ECMA 1
 
PropertiesNNIEECMA
 arguments An array with the arguments passed to a function.2+4+ECMA 1
 arguments.callee The function body of the currently executing function.2+5.5+ECMA 1
 arguments.length Number of arguments passed to the function.2+5.5+ECMA 1
 caller Reference to the function that created an object.3+4+ECMA 1
 constructor Reference to the function that created an object.2+4+ECMA 1
 length Number of arguments expected by the function.2+4+ECMA 1
 prototype Creates a new method for Function objects.2+4+ECMA 1





 Function Core object 
 Creates a new function.
 
Syntax:

Syntax 1
  function functionName([argname1 [, ...[, argnameN]]]){
   body
}


Syntax 2
  functionName = new Function( [argname1, [... argnameN,]] body );

 
Browser support:
 Microsoft Internet Explorer: 4+
 Netscape Browser: 2+
 
Implementations:
 JavaScript 1.1 (by Netscape)
 JScript 2 (by Microsoft)
 ECMA Script 1 (ECMA Standard)
 
 
Example:

Example 1 :

  function myFunction(){
  alert('I AM ALIVE');
  }


Example 2 :

  <html>
  <head>
  <title>Example page</title>
  <script language="JavaScript">
 
  function myMessenger(message){
  alert('IMPORTANT MESSAGE: '+message);
  }
 
  </script>
 
  <body onLoad="myMessenger('PAGE IS LOADED')">
  Bla, bla, bla
  <a href="#" onClick="myMessenger('YOU HIT THE LINK!');">CLICK HERE</a>
  </body>
  </html>



















DEVELOPER TIP!
FACT:
Few of the web's most visited sites use more than 15 different tags.
TIP:
An HTML editor may help you create pages faster.
But it also means that your pages load slower and that your design options are limited.

It doesn't take a hardcore nerd to learn 15 tags in HTML!





     "Better Than Books - As Easy As It Gets!"


On EchoEcho: D-Zine Articles | Tutorials | Online Tools | Free Resources | References | Quiz | HostingAbout EchoEcho