home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / Chip_2001-05_cd2.bin / ChipCD / browsery / msie6_beta / iew2k_1.cab / browselc.dll / HTML / IMGBTN.HTC < prev    next >
Encoding:
HTML Component  |  2000-11-13  |  2.1 KB  |  92 lines

  1. <public:component>
  2.  
  3. <public:property name="srcLo"/>
  4. <public:property name="srcHi"/>
  5. <public:property name="maskColor"/>
  6.  
  7. <public:attach event="onload" for="window" onevent="InitButton();" />
  8. <public:attach event="onmouseover" onevent="MouseOverButton();" />
  9. <public:attach event="onmousemove" onevent="MouseOverButton();" />
  10. <public:attach event="onmouseout" onevent="MouseOutButton();" />
  11. <public:attach event="onmousedown" onevent="MouseDownButton();" />
  12. <public:attach event="onmouseup" onevent="MouseUpButton();" />
  13. <public:attach event="onfocus" onevent="MouseOverButton();" />
  14. <public:attach event="onblur" onevent="MouseOutButton();" />
  15. <public:attach event="onkeydown" onevent="KeyDownButton();" />
  16. <public:attach event="onkeyup" onevent="KeyUpButton();" />
  17. <public:attach event="onclick" onevent="OnClick();" />
  18.  
  19. <script language="JavaScript">
  20.  
  21. function InitButton()
  22. {
  23.     style.margin=0;
  24.     style.borderStyle = "none";
  25.     SetDefault();
  26.     element.innerHTML = "<IMG width=20 height=20 style='filter:chroma(color=#FF00FF)'/>";
  27.     firstChild.src = srcLo;
  28.     if (maskColor)
  29.         firstChild.filters.chroma.color = maskColor;
  30. }
  31.  
  32. function MouseOverButton()
  33. {
  34.     firstChild.src = srcHi;
  35. }
  36.  
  37. function MouseOutButton()
  38. {
  39.     firstChild.src = srcLo;
  40.     SetDefault();
  41. }
  42.  
  43. function MouseDownButton()
  44. {
  45.     //style.borderStyle="inset";
  46.     style.paddingLeft = 3;
  47.     style.paddingTop = 3;
  48.     style.paddingRight = 2;
  49.     style.paddingBottom = 2;
  50. }
  51.  
  52. function MouseUpButton()
  53. {
  54.     SetDefault();
  55. }
  56.  
  57. function SetDefault()
  58. {
  59.     //style.borderStyle = "none";
  60.     style.paddingLeft = 2;
  61.     style.paddingTop = 2;
  62.     style.paddingRight = 3;
  63.     style.paddingBottom = 3;
  64. }
  65.  
  66. function KeyDownButton()
  67. {
  68.     // Space and Enter act just like MouseDown
  69.     if (event.keyCode == 13 || event.keyCode == 32)
  70.     {
  71.         MouseDownButton();
  72.     }
  73. }
  74.  
  75. function KeyUpButton()
  76. {
  77.     // Space and Enter act just like MouseUp
  78.     if (event.keyCode == 13 || event.keyCode == 32)
  79.     {
  80.         MouseUpButton();
  81.     }
  82. }
  83.  
  84. function OnClick()
  85. {
  86.     firstChild.src = srcLo;
  87. }
  88.  
  89. </script>
  90.  
  91. </public:component>
  92.