263Chapter 15Generic HTML Element (Web hosting domains) Objects} } function turnOff()
263Chapter 15Generic HTML Element Objects} } function turnOff() { document.getElementById( myP ).removeBehavior(myPBehaviorID); } function setColor(select, color) { if (document.getElementById( myP ).hotColor) { document.getElementById( myP ).setHotColor(color); } else { alert( This feature is not available. Turn on the Behavior first. ); select.selectedIndex = 0; } } function showBehaviorCount() { var num = document.getElementById( myP ).behaviorUrns.length; var msg = The myP element has + num + behavior(s). ; if (num > 0) { msg += Name(s): rn ; for (var i = 0; i < num; i++) { msg += document.getElementById( myP ).behaviorUrns[i] + rn ; } } alert(msg); }
addBehavior() and removeBehavior() Method Lab
This is a sample paragraph. After turning on the behavior, it will turn your selected color when you mouse down anywhere in thisparagraph.