Listing 8.105 Example of the unwatch() Method of the Document Object

<html><b>What color is this text?</b><br><br><script type="text/javascript" language="JavaScript"><!--function alertme(id,oldValue,newValue){    document.write(id + " changed from " + oldValue + " to ");    document.write(newValue + "<br>");    return newValue;}// Start watchdocument.watch("fgColor",alertme);document.write("Original text color: " + document.fgColor + "<br>");// Change text colordocument.fgColor = "Blue";document.write("New text color: " + document.fgColor + "<br>");// Stop watch ...

Get Pure JavaScript, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.