找回密码
 注-册

QQ登录

只需一步,快速开始

查看: 1042|回复: 0

[特效] 仿Office 2003的工具条

[复制链接]
Leya 发表于 2008-3-31 11:22:16 | 显示全部楼层 |阅读模式
  1. <html>

  2. <head>
  3. <meta http-equiv="Content-Language" content="zh-cn">
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  5. <title>仿Office 2003的工具条</title>
  6. <script>
  7. var listnum=0;
  8. var menu_height;
  9. var menu_width;
  10. var menu_left;
  11. var menu_top;
  12. var topMar = 1;
  13. var leftMar = -2;
  14. var space = 1;
  15. var isvisible;

  16. function listbox(listname,buttonname,valuename)
  17. {
  18. this.listname=listname
  19. this.buttonname=buttonname
  20. this.valuename=valuename
  21. }

  22. function listaction(obj,action,showlist,scroll,tw)
  23. {
  24. num=obj.id.charAt(obj.id.length-1)
  25. if (!scroll) {scroll=0}
  26. if (!tw) {tw=105}
  27. listbox=eval(lb[num].listname)
  28. listbutton=eval(lb[num].buttonname)
  29. listvalue=eval(lb[num].valuename)
  30. switch (action)
  31. {
  32.   case 0:
  33.   listbox.className="getlist";listbutton.className="listover"
  34.   break;
  35.   case 1:
  36.   if (listbox.gf=="0")
  37.   {listbox.className="lostlist";listbutton.className="menubar"}
  38.   break;
  39.   case 2:
  40. for (i=0;i<lb.length;i++)
  41. {
  42. if (num!=i.toString()){
  43. nlistbox=eval(lb[i].listname)
  44. nlistbutton=eval(lb[i].buttonname)
  45. nlistvalue=eval(lb[i].valuename)
  46. nlistbox.className="lostlist";nlistbutton.className="menubar"
  47. nlistbox.gf="0"
  48.   }
  49. }
  50.   ShowMenu(listbox,showlist,tw,scroll);listbox.className="getlist";listbox.gf="1"
  51.   listnum=num;
  52.   break;
  53.   }
  54. }

  55. function HideMenu()
  56. {
  57. var mX;
  58. var mY;
  59. var vDiv;
  60. var mDiv;
  61. if (isvisible == true)
  62. {
  63.   vDiv = document.all("listDiv");
  64.   mX = window.event.clientX + document.body.scrollLeft;
  65.   mY = window.event.clientY + document.body.scrollTop;
  66.   if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) ||
  67.    (mY < parseInt(vDiv.style.top)-menu_height) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight))  {
  68.    vDiv.style.visibility = "hidden";
  69.    isvisible = false;
  70.   }
  71. }

  72. if (isvisible==false)
  73. {
  74.   for (i=0;i<lb.length;i++)
  75. {
  76. listbox=eval(lb[i].listname)
  77. listbutton=eval(lb[i].buttonname)
  78. listvalue=eval(lb[i].valuename)
  79. listbox.className="lostlist";listbutton.className="menubar"
  80. listbox.gf="0"
  81. }
  82. }
  83. }

  84. function ShowMenu(obj,vMnuCode,tWidth,scroll) {
  85. vMnuCode = "<table id='submenu' cellspacing=0 cellpadding=0 bgcolor=#ffffff border=0 style='width:"+tWidth +
  86.       ";border-collapse: collapse' class='listDiv'><tr height=23><td nowrap align=left>" +
  87.        vMnuCode + "</td></tr></table>";

  88. menu_height = obj.offsetHeight;
  89. menu_width = obj.offsetWidth;
  90. menu_left = obj.offsetLeft + leftMar+2;
  91. menu_top = obj.offsetTop + topMar + menu_height + space-3;
  92. vParent = obj.offsetParent;
  93. while (vParent.tagName.toUpperCase() != "BODY")
  94. {
  95.   menu_left += vParent.offsetLeft;
  96.   menu_top += vParent.offsetTop;
  97.   vParent = vParent.offsetParent;
  98. }

  99. listDiv.innerHTML = vMnuCode;
  100. listDiv.style.top = menu_top;
  101. listDiv.style.left = menu_left;

  102. if (scroll==0) {listDiv.style.overflow="visible";listDiv.style.width=tWidth}
  103. else {listDiv.style.overflow="scroll";listDiv.style.width=tWidth+18}
  104. listDiv.style.visibility = "visible";
  105. var cssopaction=submenu.filters[0].opacity
  106. submenu.filters[0].opacity=0;
  107.     submenu.filters[1].Apply();
  108.     submenu.filters[0].opacity=100;
  109.     submenu.filters[1].Play();


  110. isvisible = true;
  111. }

  112. function menuitem(lightcolor,normalcolor,icon,title,url)
  113. {
  114. this.lightcolor=lightcolor
  115. this.normalcolor=normalcolor
  116. this.icon=icon
  117. this.title=title
  118. this.url=url
  119. }

  120. function bulidmenu(arrayname)
  121. {
  122. var menuarray=eval(arrayname)
  123. menucontent='<table border="0" width="100%">'
  124. for (i=0;i<menuarray.length;i++)
  125. {
  126. if (menuarray[i].title!="_line")
  127. {
  128. if (menuarray[i].url!="_disable"){css="getitem"}else{css="lostitem"}
  129. if (menuarray[i].icon.length==0)
  130. {
  131. content='<table cellspacing="0" cellpadding="0"><tr><td style="text-indent:4px" class="'+css+'">'+menuarray[i].title+'</td></tr></table>'
  132. }
  133. else
  134. {
  135. content='<table cellspacing="0" cellpadding="0"><tr><td width="20" nowrap><img src="'+menuarray[i].icon+'"></td><td class="'+css+'">'+menuarray[i].title+'</td></tr></table>'
  136. }

  137. if (menuarray[i].url!="_disable"){
  138. menucontent=menucontent+'<tr><td height=16 style="cursor:default" onmouseover="style.backgroundColor=\''+ menuarray[i].lightcolor+'\'" onmouseout="style.backgroundColor=\''+ menuarray[i].normalcolor+'\'" onclick="Golist(\''+menuarray[i].title+'\')">'+content+'</td></tr>'
  139. }
  140. else
  141. {
  142. menucontent=menucontent+'<tr><td height=16 style="fitler:gray">'+content+'</td></tr>'
  143. }

  144. }
  145. else
  146. {
  147. menucontent=menucontent+'<tr><td height=4><img src="images/dock.gif" width="99%" height=1></td></tr>'
  148. }


  149. }
  150. menucontent=menucontent+"</table>"
  151. return menucontent
  152. }

  153. function HL_Menu(obj,state)
  154. {
  155. switch (state)
  156. {
  157. case 0:
  158. obj.className="menuover"
  159. break;
  160. case 1:
  161. obj.className="menuup"
  162. break;
  163. }
  164. }

  165. var lb=new Array()
  166. lb[0]=new listbox('listbox0','listbutton0','listvalue0')
  167. lb[1]=new listbox('listbox1','listbutton1','listvalue1')

  168. var list1=new Array()
  169. list1[0]=new menuitem("#B1CBE4","","","ListItem1","")
  170. list1[1]=new menuitem("#B1CBE4","","","ListItem2","")
  171. list1[2]=new menuitem("#B1CBE4","","","ListItem3","")
  172. list1[3]=new menuitem("#B1CBE4","","","ListItem4","")
  173. list1[4]=new menuitem("#B1CBE4","","","ListItem5","")
  174. list1[5]=new menuitem("#B1CBE4","","","ListItem6","")
  175. list1[6]=new menuitem("#B1CBE4","","","ListItem7","")
  176. list1[7]=new menuitem("#B1CBE4","","","ListItem8","")
  177. list1[8]=new menuitem("#B1CBE4","","","ListItem9","")
  178. list1[9]=new menuitem("#B1CBE4","","","ListItem10","")

  179. blist1=bulidmenu("list1")


  180. var list2=new Array()
  181. list2[0]=new menuitem("#B1CBE4","","","字体1","")
  182. list2[1]=new menuitem("#B1CBE4","","","字体2","")
  183. list2[2]=new menuitem("#B1CBE4","","","字体3","")
  184. list2[3]=new menuitem("#B1CBE4","","","字体4","")
  185. list2[4]=new menuitem("#B1CBE4","","","字体5","")
  186. list2[5]=new menuitem("#B1CBE4","","","字体6","")
  187. list2[6]=new menuitem("#B1CBE4","","","字体7","")
  188. list2[7]=new menuitem("#B1CBE4","","","字体8","")
  189. list2[8]=new menuitem("#B1CBE4","","","字体9","")
  190. list2[9]=new menuitem("#B1CBE4","","","字体10","")

  191. blist2=bulidmenu("list2")
  192. function Golist(text)
  193. {
  194. listvalue=eval(lb[listnum].valuename)
  195. listvalue.innerText=text
  196. vDiv = document.all("listDiv");
  197. vDiv.style.visibility = "hidden";
  198. isvisible = false;
  199. }
  200. </script>

  201. <style>
  202. .lostfocus { border: 1px #ffffff solid; background-color: #ffffff; font-size: 12px; font-family: Arial; }
  203. .getfocus { border: 1px #08246B solid;background-color: #ffffff; font-family: Arial; font-size: 12px; }

  204. .menubar {filter:progid:DXImageTransform.Microsoft.Gradient(gradienttype=0, startcolorstr=#F7F7F7, endcolorstr=#DEDBD6)}
  205. .bodybar {filter:progid:DXImageTransform.Microsoft.Gradient(gradienttype=1, endcolorstr=#F7F7F7, startcolorstr=#DEDBD6)}
  206. .leftitem { font-family: Arial; font-size: 12px; color: #000000; cursor: hand }
  207. .getitem { font-family: Arial; font-size: 12px; color: #000000; cursor: default }
  208. .lostitem { cursor: default; color: #808080; font-size: 12px; font-family: Arial; }
  209. .menuup { PADDING-LEFT: 4px; PADDING-RIGHT: 4px; CURSOR: hand;}
  210. .menuover { PADDING-LEFT: 3px; PADDING-RIGHT: 3px; BACKGROUND-COLOR: #B5BED6; BORDER: 1px solid #08246B; CURSOR: hand; }
  211. .lostlist { border: 1px #ffffff solid; background-color: #ffffff; font-size: 12px; font-family: Arial; }
  212. .getlist  { border: 1px #08246B solid;background-color: #ffffff; font-family: Arial; font-size: 12px; }

  213. .listover {BACKGROUND-COLOR: #B5BED6; BORDER-left:1px solid #08246B}
  214. .listDiv { filter: alpha(opacity=90,finishopacity=0,style=0) blendtrans(duration=.3); }

  215. </style>
  216. </head>

  217. <body onclick="HideMenu()" style="margin:0px" bgcolor="999999">
  218. <div id=listDiv style='border:1px #636563 solid;VISIBILITY: hidden;POSITION: absolute;overflow:scroll;height:150'></div>
  219. <table border="0" width="100%" id="table27" class="bodybar" cellspacing="0" cellpadding="0">
  220. <tr>
  221.   <td>
  222. <table border="0" cellspacing="0" cellpadding="0" height="30">
  223. <tr>
  224.   <td><table border="0" cellspacing="0" cellpadding="0" height="22">
  225.    <tr>
  226.        <td width="5"></td>
  227.     <td nowrap align="center" onmouseover="HL_Menu(this,0)" onmouseout="HL_Menu(this,1)" class="menuup">
  228.     <table border="0" cellspacing="0" cellpadding="0"><tr><td class="leftitem">文件(F)</td></tr></table>
  229.     </td>
  230.     <td width="5"></td>
  231.     <td nowrap align="center" onmouseover="HL_Menu(this,0)" onmouseout="HL_Menu(this,1)" class="menuup">
  232.     <table border="0" cellspacing="0" cellpadding="0"><tr><td class="leftitem">编辑(E)</td></tr></table>
  233.     </td>
  234.    </tr>
  235.   </table></td>
  236. </tr>
  237. </table>
  238.   </td>
  239. </tr>
  240. <tr>
  241.   <td>
  242. <table border="1" width="100" id="table28" cellspacing="0" cellpadding="4" bgcolor="#F7F7F7"  style="border-collapse: collapse">
  243. <tr>
  244.   <td class="menubar">
  245.    <table border="0" width="100%" id="table29" cellspacing="0" cellpadding="0">
  246.     <tr>
  247.        <td width="10" nowrap>
  248.      <table border="0" width="2" cellspacing="0" cellpadding="1" id="table30">
  249.    <tr>
  250.     <td><img style="border:1px inset" height=1 width=1></td>
  251.    </tr>
  252.    <tr>
  253.     <td><img style="border:1px inset" height=1 width=1></td>
  254.    </tr>
  255.    <tr>
  256.     <td><img style="border:1px inset" height=1 width=1></td>
  257.    </tr>
  258.    <tr>
  259.     <td><img style="border:1px inset" height=1 width=1></td>
  260.    </tr>
  261.    </table></td>
  262.      <td width="35" nowrap><font size="2">姓名</font></td>
  263.      <td width="130" nowrap>
  264.    <input type="text" name="T5" size="18" class="lostfocus" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="lostfocus"' onblur='this.className="lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'></td>
  265.      <td width="35" nowrap><font size="2">密码</font></td>
  266.      <td width="124" nowrap>
  267.    <input type="password" name="T6" size="18" class="lostfocus" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="lostfocus"' onblur='this.className="lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'></td>
  268.      <td width="5" nowrap><img style="border:1px inset" height=14 width=0></td>
  269.      <td nowrap align="center" onmouseover="HL_Menu(this,0)" onmouseout="HL_Menu(this,1)" class="menuup">
  270.     <table cellspacing="0" cellpadding="0" id="table31" width="25"><tr><td nowrap></td><td class="leftitem">
  271.      登陆</td></tr></table>
  272.     </td>
  273.      <td width="100%" nowrap> </td>
  274.     </tr>
  275.    </table>
  276.   </td>
  277. </tr>
  278. </table>

  279.   </td>
  280. </tr>
  281. <tr>
  282.   <td>

  283. <table border="1" width="100" id="table32" cellspacing="0" cellpadding="4" bgcolor="#F7F7F7"  style="border-collapse: collapse">
  284. <tr>
  285.   <td class="menubar">
  286.    <table border="0" width="100%" id="table33" cellspacing="0" cellpadding="0">
  287.     <tr>
  288.        <td width="10" nowrap>
  289.      <table border="0" width="2" cellspacing="0" cellpadding="1" id="table34">
  290.    <tr>
  291.     <td><img style="border:1px inset" height=1 width=1></td>
  292.    </tr>
  293.    <tr>
  294.     <td><img style="border:1px inset" height=1 width=1></td>
  295.    </tr>
  296.    <tr>
  297.     <td><img style="border:1px inset" height=1 width=1></td>
  298.    </tr>
  299.    <tr>
  300.     <td><img style="border:1px inset" height=1 width=1></td>
  301.    </tr>
  302.    </table></td>
  303.      <td width="78" nowrap>
  304.    <div id="listbox0" class="lostfocus" gf="0" onmouseover='listaction(this,0)' onmouseout='listaction(this,1)' onclick='listaction(this,2,blist1,0)' style="cursor:default">
  305.    <table border="0" cellpadding="0" cellspacing="0" width="100" height="18" id="table35">
  306. <tr>
  307.   <td valign=center style="text-indent:4px"><font size="2" face="Verdana">
  308.   <span id=listvalue0>
  309.     </span></font></td>
  310.   <td width=12 align="center" class="menubar" id="listbutton0">
  311. <table border="0" cellpadding="0" style="border-collapse: collapse" id="table36">
  312.   <tr height=1>
  313.    <td width="1" bgcolor="#000000"></td>
  314.    <td width="1" bgcolor="#000000"></td>
  315.    <td width="1" bgcolor="#000000"></td>
  316.    <td width="1" bgcolor="#000000"></td>
  317.    <td width="1" bgcolor="#000000"></td>
  318.   </tr>
  319.   <tr height=1>
  320.    <td></td>
  321.    <td bgcolor="#000000"></td>
  322.    <td bgcolor="#000000"></td>
  323.    <td bgcolor="#000000"></td>
  324.    <td></td>
  325.   </tr>
  326.   <tr height=1>
  327.    <td></td>
  328.    <td></td>
  329.    <td bgcolor="#000000"></td>
  330.    <td></td>
  331.    <td></td>
  332.   </tr>
  333. </table></td>
  334. </tr>
  335. </table>

  336.    </div></td>
  337.      <td width="78" nowrap>
  338.    <div id="listbox1" class="lostfocus" gf="0" onmouseover='listaction(this,0)' onmouseout='listaction(this,1)' onclick='listaction(this,2,blist2,1,100)' style="cursor:default">
  339.    <table border="0" cellpadding="0" cellspacing="0" width="100" height="18" id="table37">
  340. <tr>
  341.   <td valign=center style="text-indent:4px"><font size="2" face="Verdana"><span id=listvalue1>
  342.     </span></font></td>
  343.   <td width=12 align="center" class="menubar" id="listbutton1">
  344. <table border="0" cellpadding="0" style="border-collapse: collapse" id="table38">
  345.   <tr height=1>
  346.    <td width="1" bgcolor="#000000"></td>
  347.    <td width="1" bgcolor="#000000"></td>
  348.    <td width="1" bgcolor="#000000"></td>
  349.    <td width="1" bgcolor="#000000"></td>
  350.    <td width="1" bgcolor="#000000"></td>
  351.   </tr>
  352.   <tr height=1>
  353.    <td></td>
  354.    <td bgcolor="#000000"></td>
  355.    <td bgcolor="#000000"></td>
  356.    <td bgcolor="#000000"></td>
  357.    <td></td>
  358.   </tr>
  359.   <tr height=1>
  360.    <td></td>
  361.    <td></td>
  362.    <td bgcolor="#000000"></td>
  363.    <td></td>
  364.    <td></td>
  365.   </tr>
  366. </table></td>
  367. </tr>
  368. </table>

  369.    </div></td>
  370.      <td width="4" nowrap>
  371.     </td>
  372.      <td width="5" nowrap><img style="border:1px inset" height=14 width=0></td>
  373.      <td nowrap align="center" onmouseover="HL_Menu(this,0)" onmouseout="HL_Menu(this,1)" class="menuup">
  374.     <table cellspacing="0" cellpadding="0" id="table39" width="16"><tr><td nowrap></td><td class="leftitem" align=center>
  375.      <b>B</b></td></tr></table>
  376.     </td>
  377.          <td nowrap align="center" onmouseover="HL_Menu(this,0)" onmouseout="HL_Menu(this,1)" class="menuup">
  378.     <table cellspacing="0" cellpadding="0" id="table40" width="16"><tr><td nowrap></td><td class="leftitem" align=center>
  379.      <i>
  380.      <b>I</b></i></td></tr></table>
  381.     </td>
  382.     <td nowrap align="center" onmouseover="HL_Menu(this,0)" onmouseout="HL_Menu(this,1)" class="menuup">
  383.     <table cellspacing="0" cellpadding="0" id="table41" width="16"><tr><td nowrap></td><td class="leftitem" align=center>
  384.      <u>
  385.      <b>U</b></u></td></tr></table>
  386.     </td>
  387.      <td width="100%" nowrap> </td>
  388.     </tr>
  389.    </table>
  390.   </td>
  391. </tr>
  392. </table>
  393.   </td>
  394. </tr>
  395. </table>
  396. </body>
  397. </html>
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注-册

本版积分规则

Archiver|手机版|小黑屋|DoDVip ( 桂ICP备14000730号 )

GMT+8, 2025-5-2 13:39 , Processed in 0.069551 second(s), 20 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表