Internet Explorer 5.0, Part II: Scriptlet Code - Doc JavaScript | WebReference

Internet Explorer 5.0, Part II: Scriptlet Code - Doc JavaScript


Scriptlet Code

<SCRIPTLET ID="xmixdrix">
<IMPLEMENTS ID="kuku" TYPE="Behavior" DEFAULT>
<EVENT NAME="onBoxLoad"/>
<EVENT NAME="onBoxClick"/>
</IMPLEMENTS>
<IMPLEMENTS TYPE="Automation">
<PROPERTY NAME="x"/>
<PROPERTY NAME="y"/>
</IMPLEMENTS>
<SCRIPT LANGUAGE="JavaScript">
style.position = "absolute";
style.pixelTop = y;
style.pixelLeft = x;
src = "ibutton.bmp";
window.lastPlayedBy = "o";
window.attachEvent("onload", onload);
attachEvent("onclick", onclick);
function onclick() {
  if (src.indexOf("ibutton.bmp") < 0) return;  
  clickEvent = createEventObject();
  clickEvent.id = uniqueID;
  if (window.lastPlayedBy == "o") {
    src = "xbutton.bmp";
    window.lastPlayedBy = "x";
    clickEvent.playedBy = "x";
  }
  else {  // lastPlayedBy = "x"
    src = "obutton.bmp";
    window.lastPlayedBy = "o";
    clickEvent.playedBy = "o";
  }
  fireEvent("onBoxClick", clickEvent);
}
function onload() {
  loadEvent = createEventObject();
  loadEvent.id = uniqueID;
  fireEvent("onBoxLoad",loadEvent);
}
</SCRIPT>
</SCRIPTLET>

http://www.internet.com


Created: August 11, 1998
Revised: August 11, 1998

URL: http://www.webreference.com/js/column23/code2.html