1102 Part IV . JavaScript Core Language Reference (Http web server)

1102 Part IV . JavaScript Core Language Reference As for succeeding parameters, the apply() method s second parameter is an array of values to be passed as parameters to the current function. The order of the values must match the order of parameter variables defined for the function. The call() method, on the other hand, enables you to pass individual parameters in a comma-delimited list. Your choice depends on how the parameters are carried along in your script. If they re already in array form, then use the apply()method; otherwise, use the call()method. The (ECMA) recommended way to invoke a function through this mechanism when no parameters need to be passed is via the call() method. toString() valueOf() Returns: String. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility . . . Scripts rarely, if ever, summon the toString()and valueOf() methods of a function object. They work internally to allow debugging scripts to display a string version of the function definition. For example, when you enter the name of a func tion defined in The Evaluator into the top text box, JavaScript automatically con verts the function to a string so that its value can be displayed in the Results box. Using these methods or parsing the text they return has little, if any, practical application. Function Application Notes Understanding the ins and outs of JavaScript functions is the key to successful scripting, especially for complex applications. Additional topics covered in this chapter include the ways to invoke functions, variable scope in and around func tions, recursion, and the design of reusable functions. Invoking Functions A function doesn t perform any work until a script calls it by name or reference. Scripts invoke functions (that is, get functions to do something) via four routes: document object event handlers; JavaScript statements; HREF attributes pointing to a javascript:URL; and the more recent call() and apply()methods of function objects. The one approach not discussed at length yet in this book is the javascript: URL (some say pseudo-URL). Several HTML tags have HREF attributes that normally point to Internet URLs for navigating to another page or loading a MIME file that requires a helper application or plug-in. These HTML tags are usually tags for clickable objects, such as links and client-side image map areas. functionObject.toString()
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply