home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 June / CHIP_CD_2004-06.iso / bonus / buhgal / files / M12USWEB.exe / RCDATA / CABINET / money.cab / ChkBxCls.htc < prev    next >
Text File  |  2003-06-18  |  5KB  |  185 lines

  1. <PUBLIC:COMPONENT tagName=CheckBox >
  2. <public:defaults 
  3.     viewLinkContent
  4.     tabStop = true 
  5.     viewMasterTab = true 
  6. />
  7. <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="Main()" />
  8. <PRIVATE:PROPERTY NAME="StaticColor" />
  9. <PRIVATE:PROPERTY NAME="HoverColor" />
  10. <PRIVATE:PROPERTY NAME="Value" />
  11. <PUBLIC:METHOD NAME="SetValue" />
  12. <PUBLIC:METHOD NAME="GetValue" />
  13. </PUBLIC:COMPONENT>
  14. <!----------------------------------------------------------
  15.     Copyright (c) 2001 Microsoft Corporation.
  16.     All rights reserved.
  17.  
  18.     File:       ChkBxCls.htc
  19.     Revised:    Oct 26 2001
  20. --------------------------------------------------------- -->
  21. <HTML xmlns:mnydraw="urn:schemas-microsoft-com:vml">
  22. <HEAD>
  23. <STYLE TYPE="text/css">
  24. <!--
  25. mnydraw\:*{behavior: url(#default#VML);}
  26. -->
  27. </STYLE>
  28. <SCRIPT TYPE="text/jscript" LANGUAGE="JScript">
  29. <!--
  30.  
  31. @set @debug = false;
  32.  
  33. //**************************************************
  34. function GetChecked()
  35. {
  36.     if(element.checked)
  37.     {
  38.         var fChckd = new Boolean();
  39.         fChckd  = eval(element.checked);
  40.         return fChckd;
  41.     }
  42.     else
  43.     {
  44.         return false;
  45.     }
  46. }
  47. //**************************************************
  48. function SetValue(fState)
  49. {
  50.     Value = fState;
  51.     htmCaption.style.top = (Value) ? "-2pt" : "-50";
  52. }
  53. //**************************************************
  54. function GetValue()
  55. {
  56.     return Value;    
  57. }
  58. //**************************************************
  59. function Main()
  60. {
  61.     element.style.width  = "10pt";
  62.     element.style.height = "9pt";
  63.     
  64.     StaticColor = "#ffffff";
  65.     HoverColor  = "#eeeeee";
  66.     
  67.     var fChckd  = GetChecked();
  68.     var hChkBx = new CheckBox();
  69.     document.body.appendChild(hChkBx);
  70.     
  71.     SetValue(fChckd);
  72.     
  73.     document.body.onselectstart = function()
  74.     {
  75.         return false;
  76.     }
  77.     document.body.oncontextmenu = function()
  78.     {
  79.         return false;
  80.     }
  81.     document.body.onkeydown = function()
  82.     {
  83.         if(window.event.keyCode == 32)
  84.         {
  85.             window.event.cancelBubble = true;
  86.             window.event.returnValue  = false;
  87.             
  88.             var fChkd = GetValue();
  89.             fChkd = (fChkd) ? false : true;
  90.             SetValue(fChkd);
  91.             chkBox.blur();
  92.         }
  93.     }
  94. }
  95. //**************************************************
  96. function CheckBox()
  97. {
  98.     var hChkBx = document.createElement("DIV");
  99.     var hCptn  = new Caption();
  100.     var hPlyLn = document.createElement("mnydraw:polyline");
  101.     
  102.     hChkBx.id             = "chkBox";
  103.     hChkBx.tabIndex       = 1;
  104.     hChkBx.hideFocus      = true;
  105.     hChkBx.style.position = "absolute";
  106.     hChkBx.style.top      = 0;
  107.     hChkBx.style.left     = 0;
  108.     hChkBx.style.width    = "15pt";
  109.     hChkBx.style.height   = "15pt";
  110.     hChkBx.style.cursor   = "default";
  111.     
  112.     hPlyLn.id             = "shpOutline";
  113.     hPlyLn.fillcolor      = StaticColor;
  114.     hPlyLn.strokecolor    = "#999999";
  115.     hPlyLn.points         = "0pt,0pt 0pt,8pt 8pt,8pt 8pt,0pt 0pt,0pt";
  116.     
  117.     hChkBx.onfocus        = CheckBox_Focus;
  118.     hChkBx.onblur         = CheckBox_Blur;
  119.     hChkBx.onclick        = CheckBox_Click;
  120.     hChkBx.onkeydown      = CheckBox_KeyDown;
  121.     hChkBx.appendChild(hCptn);
  122.     hChkBx.appendChild(hPlyLn);
  123.     
  124.     return hChkBx;
  125. }
  126. //**************************************************
  127. function Caption()
  128. {
  129.     var hCptn = document.createElement("DIV");
  130.     
  131.     hCptn.id               = "htmCaption";
  132.     hCptn.style.position   = "absolute";
  133.     hCptn.style.top        = "-50pt";
  134.     hCptn.style.left       = 0;
  135.     hCptn.style.fontFamily = ResourceList.documentElement.selectSingleNode("properties/member[@name='Caption']/style[@name='cssFontFamily']").text;
  136.     hCptn.style.fontSize   = "10pt";
  137.     hCptn.style.zIndex     = 2;
  138.     
  139.     var hSprt = document.createTextNode(String.fromCharCode(97));
  140.     hCptn.appendChild(hSprt);
  141.     
  142.     return hCptn;
  143. }
  144. //**************************************************
  145. function CheckBox_Click()
  146. {
  147.     var fVlu = GetValue();
  148.     fVlu = (fVlu) ? false : true;
  149.     SetValue(fVlu);
  150.     chkBox.blur();
  151. }
  152. //**************************************************
  153. function CheckBox_KeyDown()
  154. {
  155.     if(window.event.keyCode == 13)
  156.     {
  157.         var fVlu = GetValue();
  158.         fVlu = (fVlu) ? false : true;
  159.         SetValue(fVlu);
  160.         chkBox.blur();
  161.     }
  162. }
  163. //**************************************************
  164. function CheckBox_Focus()
  165. {
  166.     shpOutline.fillcolor = HoverColor;
  167. }
  168. //**************************************************
  169. function CheckBox_Blur()
  170. {
  171.     shpOutline.fillcolor = StaticColor;
  172. }
  173. //-->
  174. </SCRIPT>
  175. <XML ID="ResourceList">
  176.     <MnyVwrRsrc xmlns="urn:schemas-microsoft.com:mnyvwr-resource">
  177.         <properties>
  178.             <member name="Caption">
  179.                 <style name="cssFontFamily">Webdings</style>
  180.             </member>
  181.         </properties>
  182.     </MnyVwrRsrc>
  183. </XML>
  184. </HEAD><BODY></BODY></HTML>
  185.