home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 December / PCWorld_2002-12_cd.bin / Software / Topware / wmp99xrc / mpsetup.exe / wmploc.DLL / HTML / NAVBUTTON.HTC < prev    next >
Encoding:
HTML Component  |  2002-10-28  |  3.1 KB  |  99 lines

  1. <PUBLIC:COMPONENT lightWeight=true>
  2. <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="load()" />
  3. <PUBLIC:PROPERTY NAME="enabled" PUT='setEnabled' GET='getEnabled'/>
  4. <PUBLIC:PROPERTY NAME="text" />
  5. <PUBLIC:PROPERTY NAME="image" />
  6. <PUBLIC:ATTACH EVENT="onmouseout"  ONEVENT="mouseout()" />
  7. <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="mouseover()" />
  8. <PUBLIC:ATTACH EVENT="onmousedown" ONEVENT="clickIt()" />
  9. <PUBLIC:ATTACH EVENT="onmouseup" ONEVENT="clicked()" />
  10. <PUBLIC:METHOD NAME="colorChange" />
  11.  
  12. <SCRIPT LANGUAGE="JScript">
  13.  
  14. var iEnabled = 1, fLoaded = false;
  15. var aEnabled = new Array('#d6d6d6', 'white');
  16. var aImgExt = new Array('dis', 'def', 'hvr', 'dwn');
  17.  
  18. var ex;
  19.  
  20. function load() 
  21.     ex = window.external;
  22.     if (!ex.appColorLight)
  23.     {
  24.         ex = new Object;
  25.         ex.appColorButtonHoverFace = 'red';
  26.         ex.appColorButtonShadow = 'orange';
  27.         ex.appColorButtonHighlight = 'purple';
  28.     }
  29.     
  30.     var s = '<table title="' + text + '" style="cursor:default; border:1 solid; border-color: ' + getCurrentColor() + '" id="' + element.uniqueID + 'button" border=0 height=22 cellpadding=0 cellspacing=0><tr>';
  31.     s += '<td width=2></td><td><img height=15 align=absmiddle border=0 id="' + element.uniqueID + 'img" src="nav\\' + image + '-' + aImgExt[iEnabled] + '.gif"></td><td width=4></td>';
  32.     s += '<td nowrap class=smtext id="' + element.uniqueID + 'text" style="color:' + aEnabled[iEnabled] + '">' + text + '</td><td width=6></td>';
  33.     element.innerHTML = s + '</tr></table></td></tr></table>';
  34.     fLoaded = true;
  35. }
  36.  
  37. function setEnabled(iE)
  38. {
  39.     if (iE == 0)
  40.         iEnabled = 0;
  41.     else
  42.         iEnabled = 1;
  43.  
  44.     if (fLoaded)
  45.         element.document.all(element.uniqueID + 'text').style.color = aEnabled[iEnabled];
  46. }
  47.  
  48. function getEnabled() { return iEnabled; }
  49.  
  50. var fOver = false;
  51. function mouseout()
  52. {
  53.     fOver = false;
  54.     var sty = element.document.all(element.uniqueID + 'button').style
  55.     sty.backgroundColor = getCurrentColor();
  56.     sty.borderColor = getCurrentColor();
  57.     element.document.all(element.uniqueID + 'img').src = 'nav\\' + image + '-' + aImgExt[iEnabled] + '.gif';
  58. }
  59.  
  60.  
  61. function mouseover()
  62. {
  63.     if (iEnabled)
  64.     {
  65.         fOver = true;
  66.         var but = element.document.all(element.uniqueID + 'button')
  67.         but.style.backgroundColor = ex.appColorButtonHoverFace;
  68.         but.style.borderColor = ex.appColorButtonHighlight + ' ' + ex.appColorButtonShadow + ' ' + ex.appColorButtonShadow + ' ' + ex.appColorButtonHighlight;
  69.         element.document.all(element.uniqueID + 'img').src = 'nav\\' + image + '-' + aImgExt[2] + '.gif';
  70.     }
  71. }
  72.  
  73. function clickIt()
  74. {
  75.     if (iEnabled)
  76.     {
  77.         var but = element.document.all(element.uniqueID + 'button')
  78.         element.document.all(element.uniqueID + 'img').src = 'nav\\' + image + '-' + aImgExt[3] + '.gif';
  79.         but.style.borderColor = ex.appColorButtonShadow + ' ' + ex.appColorButtonHighlight + ' ' + ex.appColorButtonHighlight + ' ' + ex.appColorButtonShadow;
  80.     }
  81. }
  82.  
  83. function clicked()
  84. {
  85. }
  86.  
  87. function colorChange()
  88. {
  89.     if (!fOver)
  90.     {
  91.         var sty = element.document.all(element.uniqueID + 'button').style
  92.         sty.backgroundColor = getCurrentColor();
  93.         sty.borderColor = getCurrentColor();
  94.     }
  95. }
  96. </SCRIPT>
  97. </PUBLIC:COMPONENT>
  98.