August 1999
Intermediate to advanced
1488 pages
72h 53m
English
object.watch(prop, function)
The watch() method of the Object object is used to watch for the event in which a property gets assigned a value. When the assignment is made, a user defined function is executed. The method itself takes the property to watch, prop, and the function to call, func, when the event occurs.
Listing 6.199 shows how the watch() method is used.
<html> <body> <title>Example of the watch method</title> <script language="JavaScript"> <!––Hide // function informs the user when the tmp variable is changed. function inform(){ document.write("Tmp variable changed from 1 to 3"); } // declare a tmp variable ... |
Read now
Unlock full access