home *** CD-ROM | disk | FTP | other *** search
HTML Component | 2000-11-13 | 2.1 KB | 92 lines |
- <public:component>
-
- <public:property name="srcLo"/>
- <public:property name="srcHi"/>
- <public:property name="maskColor"/>
-
- <public:attach event="onload" for="window" onevent="InitButton();" />
- <public:attach event="onmouseover" onevent="MouseOverButton();" />
- <public:attach event="onmousemove" onevent="MouseOverButton();" />
- <public:attach event="onmouseout" onevent="MouseOutButton();" />
- <public:attach event="onmousedown" onevent="MouseDownButton();" />
- <public:attach event="onmouseup" onevent="MouseUpButton();" />
- <public:attach event="onfocus" onevent="MouseOverButton();" />
- <public:attach event="onblur" onevent="MouseOutButton();" />
- <public:attach event="onkeydown" onevent="KeyDownButton();" />
- <public:attach event="onkeyup" onevent="KeyUpButton();" />
- <public:attach event="onclick" onevent="OnClick();" />
-
- <script language="JavaScript">
-
- function InitButton()
- {
- style.margin=0;
- style.borderStyle = "none";
- SetDefault();
- element.innerHTML = "<IMG width=20 height=20 style='filter:chroma(color=#FF00FF)'/>";
- firstChild.src = srcLo;
- if (maskColor)
- firstChild.filters.chroma.color = maskColor;
- }
-
- function MouseOverButton()
- {
- firstChild.src = srcHi;
- }
-
- function MouseOutButton()
- {
- firstChild.src = srcLo;
- SetDefault();
- }
-
- function MouseDownButton()
- {
- //style.borderStyle="inset";
- style.paddingLeft = 3;
- style.paddingTop = 3;
- style.paddingRight = 2;
- style.paddingBottom = 2;
- }
-
- function MouseUpButton()
- {
- SetDefault();
- }
-
- function SetDefault()
- {
- //style.borderStyle = "none";
- style.paddingLeft = 2;
- style.paddingTop = 2;
- style.paddingRight = 3;
- style.paddingBottom = 3;
- }
-
- function KeyDownButton()
- {
- // Space and Enter act just like MouseDown
- if (event.keyCode == 13 || event.keyCode == 32)
- {
- MouseDownButton();
- }
- }
-
- function KeyUpButton()
- {
- // Space and Enter act just like MouseUp
- if (event.keyCode == 13 || event.keyCode == 32)
- {
- MouseUpButton();
- }
- }
-
- function OnClick()
- {
- firstChild.src = srcLo;
- }
-
- </script>
-
- </public:component>
-