home *** CD-ROM | disk | FTP | other *** search
HTML Component | 2002-08-19 | 2.2 KB | 76 lines |
- <PUBLIC:COMPONENT lightWeight=true>
- <PUBLIC:EVENT name="onbuttonclick" ID=doclick>
- <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="load()" />
- <PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="mouseout()" />
- <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="mousemove()" />
- <PUBLIC:ATTACH EVENT="onmousedown" ONEVENT="mousedown()" />
- <PUBLIC:ATTACH EVENT="onmouseup" ONEVENT="mouseup()" />
- <PUBLIC:PROPERTY NAME="text" PUT="setText" GET="getText" />
-
- <SCRIPT LANGUAGE="JScript">
-
- var g_sText, fLoaded = false;
- function load()
- {
- var s = '<table border=0 cellpadding=0 cellspacing=0><tr>';
- s += '<td height=18 width=9 style="cursor:default"><img id="' + element.uniqueID + 'left" style="display:none" border=0 src="images\\hover-left.gif"></td>';
- s += '<td height=18 id="' + element.uniqueID + 'mid" style="cursor:default; background: transparent x repeat-x top left" class=textTitle>' + g_sText + '</td>';
- s += '<td height=18 width=9 style="cursor:default"><img id="' + element.uniqueID + 'right" style="display:none" border=0 src="images\\hover-right.gif"></td></tr></table>';
- element.innerHTML = s;
- fLoaded = true;
- }
-
- function setText(sText)
- {
- g_sText = sText;
- if (fLoaded)
- element.document.all(element.uniqueID + 'mid').innerText = g_sText;
- }
-
- function getText()
- {
- return g_sText;
- }
-
- function setImage(iMode)
- {
- var sKey, sDisplay, id, a;
-
- sDisplay = 'inline';
- if (iMode == 1)
- sKey = 'hover';
- else if (iMode == 2)
- sKey = 'down';
- else
- {
- sKey = 'normal';
- sDisplay = 'none';
- }
-
- a = element.document.all;
- id = element.uniqueID;
-
- a(id + 'left').src = 'images\\' + sKey + '-left.gif';
- if (sKey == 'normal')
- a(id + 'mid').style.backgroundImage = '';
- else
- a(id + 'mid').style.backgroundImage = 'url(images\\' + sKey + '-center.gif)';
- a(id + 'right').src = 'images\\' + sKey + '-right.gif';
- a(id + 'left').style.display = sDisplay
- a(id + 'right').style.display = sDisplay
- }
-
- function mouseout() { setImage(0); }
- function mousemove() { setImage(1); }
- function mousedown() { setImage(2); }
-
- function mouseup()
- {
- setImage(1);
- var e = createEventObject();
- doclick.fire(e);
- }
-
- </SCRIPT>
- </PUBLIC:COMPONENT>
-