|
March 21, 2000 Calls By Reference Tips: March 2000
Yehuda Shiran, Ph.D.
|
|
Version 4.0 of DOCJSLIB introduces many functions that expect the DHTML element to be passed by reference. What this means is that the object itself should pass to the appropriate function. This is in contrary to the older functions in DOCJSLIB that expect object ID to be passed as a string. You can check if the element is passed by reference or by string, by simply printing it to an alert box. The object passed by reference will be printed as an object, while the one passed by string will be printed as a string. Objects are created in JavaScript by the new operator.
Let's take an example that shows the differences between call-by-reference and call-by-string. The function
The following function sets the visibility of elements that are passed by reference (objects):
Learn more about DOCJSLIB 4.0 in Column 33, DOCJSLIB Version 4.0: Scrollers, Watermarks, and Games . People who read this tip also read these tips: Look for similar tips by subject: |