JavaScript经典效果集锦之四,五

来源:互联网 发布:身份证被别人淘宝开店 编辑:程序博客网 时间:2024/05/01 07:02

JavaScript经典效果集锦之四

二十七 超级REAL视频播放器
  1. <object id="player" name="player" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"
  2.  
  3. width="339" height="227">
  4.                           <param name="_ExtentX" value="9869">
  5. <param name="_ExtentY" value="7726">
  6. <param name="AUTOSTART" value="-1">
  7. <param name="SHUFFLE" value="0">
  8. <param name="PREFETCH" value="0">
  9. <param name="NOLABELS" value="-1">
  10. <param name="SRC" value="http://entdown.163.com/ent/garbage/mv/1028/xuemv.rm">
  11. <param name="CONTROLS" value="Imagewindow">
  12. <param name="CONSOLE" value="clip1">
  13. <param name="LOOP" value="0">
  14. <param name="NUMLOOP" value="0">
  15. <param name="CENTER" value="0">
  16. <param name="MAINTAINASPECT" value="0">
  17. <param name="BACKGROUNDCOLOR" value="#000000">
  18. </object>
  19. <br>
复制代码

二十八 网站论坛上面快捷键提交表单的方法
  1. <script language=javascript>
  2. ie = (document.all)? true:false
  3. if (ie){
  4. function ctlent(eventobject){if(event.ctrlKey &&
  5.  
  6. window.event.keyCode==13){this.document.form1.submit();}}
  7. }
  8. </script>
  9.  
  10. <form action="http://www.jluvip.com/index.html" method=POST name=form1>
  11. <textarea cols=95 name=Content rows=12 wrap=virtual onkeydown=ctlent()>
  12. Ctrl+Enter提交内容信息
  13. </textarea>
  14. <input type=Submit value="Submit" name=Submit>
  15. </form>
复制代码


二十九 accesskey 提交
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  4. <title>无标题文档</title>
  5. </head>
  6.  
  7. <body>
  8. <form action="http://www.jluvip.com/index.html" method=POST name=form1>
  9. <textarea ></textarea>
  10. <br><input type=submit accessKey="S" value=提交(Alt+s)>
  11. </form>
复制代码


三十 新闻广告图片切换效果+描述
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.  
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  7. <title>新闻切换技术</title>
  8. <style type="text/css">
  9. <!--
  10. body { text-align: center; margin:0; padding:0; background: #FFF; font-size:12px; color:#000;}
  11. div,form,img,ul,ol,li,dl,dt,dd {margin: 0; padding: 0; border: 0;}
  12. h1,h2,h3,h4,h5,h6 { margin:0; padding:0;}
  13. table,td,tr,th{font-size:12px;}
  14. a:link {color: #000; text-decoration:none;}
  15. a:visited {color: #83006f;text-decoration:none;}
  16. a:hover {color: #c00; text-decoration:underline;}
  17. a:active {color: #000;}
  18. .focusPic{margin:0 auto; width:244px;}
  19. .focusPic .pic{margin:0 auto; width:240px; height:180px; padding:2px 0 0;}
  20. .focusPic .adPic{margin:0 auto 5px; width:240px; height:29px;
  21.  
  22. overflow:hidden;background:url(http://tech.163.com/newimg/adpic.gif);}
  23. .focusPic .adPic .text{float:right; padding:9px 4px 0 0; width:140px;}
  24. .focusPic .adPic .text a{color:#1f3a87;}
  25. .focusPic .adPic .text a:hover{color:#bc2931;}
  26. .focusPic h2{ float:left; width:232px;padding:4px 0 3px 12px; font-size:14px; text-align:left;}
  27. .focusPic p{float:left; width:226px;line-height:160%; margin:0; text-align:left;padding:0 0 10px
  28.  
  29. 12px;}
  30. .focusPic p img {margin:0px 0 2px;}
  31. .focusPic .more{ margin:0 auto; width:240px; }
  32. .focusPic .more .textNum{float:right; margin:0 8px 0 0;padding:0 0 4px;}
  33. .focusPic .more .textNum .text{float:left; font-weight:bold; padding:7px 6px 0 0; color:#666;}
  34. .focusPic .more .textNum .num{float:left; width:113px; height:19px;}
  35. .focusPic .more .textNum .bg1{ background:url(http://tech.163.com/newimg/num1.gif);}
  36. .focusPic .more .textNum .bg2{ background:url(http://tech.163.com/newimg/num2.gif);}
  37. .focusPic .more .textNum .bg3{ background:url(http://tech.163.com/newimg/num3.gif);}
  38. .focusPic .more .textNum .bg4{ background:url(http://tech.163.com/newimg/num4.gif);}
  39. .focusPic .more .textNum .num ul{ float:left; width:113px;}
  40. .focusPic .more .textNum .num li{float:left; width:28px; font-weight:bold;display:block;
  41.  
  42. color:#fff; list-style-type:none; padding:6px 0 0;}
  43. .focusPic .more .textNum .num li a{color:#fff; padding:0 5px; }
  44. .focusPic .more .textNum .num li a:visited{color:#fff;}
  45. .focusPic .more .textNum .num li a:hover{color:#ff0;}
  46.  
  47. -->
  48. </style>
  49. </head>
  50.  
  51. <body>
  52. <script language="JavaScript" type="text/javascript">
  53. var nn;
  54. nn=1;
  55. setTimeout('change_img()',6000);
  56. function change_img()
  57. {
  58. if(nn>4) nn=1
  59. setTimeout('setFocus1('+nn+')',6000);
  60. nn++;
  61. tt=setTimeout('change_img()',6000);
  62. }
  63. function setFocus1(i)
  64. {
  65. selectLayer1(i);
  66. }
  67. function selectLayer1(i)
  68. {
  69. switch(i)
  70. {
  71. case 1:
  72. document.getElementById("focusPic1").style.display="block";
  73. document.getElementById("focusPic2").style.display="none";
  74. document.getElementById("focusPic3").style.display="none";
  75. document.getElementById("focusPic4").style.display="none";
  76. document.getElementById("focusPic1nav").style.display="block";
  77. document.getElementById("focusPic2nav").style.display="none";
  78. document.getElementById("focusPic3nav").style.display="none";
  79. document.getElementById("focusPic4nav").style.display="none";
  80. break;
  81. case 2:
  82. document.getElementById("focusPic1").style.display="none";
  83. document.getElementById("focusPic2").style.display="block";
  84. document.getElementById("focusPic3").style.display="none";
  85. document.getElementById("focusPic4").style.display="none";
  86. document.getElementById("focusPic1nav").style.display="none";
  87. document.getElementById("focusPic2nav").style.display="block";
  88. document.getElementById("focusPic3nav").style.display="none";
  89. document.getElementById("focusPic4nav").style.display="none";
  90. break;
  91. case 3:
  92. document.getElementById("focusPic1").style.display="none";
  93. document.getElementById("focusPic2").style.display="none";
  94. document.getElementById("focusPic3").style.display="block";
  95. document.getElementById("focusPic4").style.display="none";
  96. document.getElementById("focusPic1nav").style.display="none";
  97. document.getElementById("focusPic2nav").style.display="none";
  98. document.getElementById("focusPic3nav").style.display="block";
  99. document.getElementById("focusPic4nav").style.display="none";
  100. break;
  101. case 4:
  102. document.getElementById("focusPic1").style.display="none";
  103. document.getElementById("focusPic2").style.display="none";
  104. document.getElementById("focusPic3").style.display="none";
  105. document.getElementById("focusPic4").style.display="block";
  106. document.getElementById("focusPic1nav").style.display="none";
  107. document.getElementById("focusPic2nav").style.display="none";
  108. document.getElementById("focusPic3nav").style.display="none";
  109. document.getElementById("focusPic4nav").style.display="block";
  110. break;
  111. }
  112. }
  113. </script>
  114. <div class="focusPic">
  115. <div id="focusPic1" style="display:block ;">
  116. <div class="pic"> <a href="http://tech.163.com/special/000915SN/soft2005.html"><img
  117.  
  118. src="http://cimg.163.com/tech/2006/1/18/2006011810122068706.jpg" alt="网易学院05年软件评选结果"
  119.  
  120. width="240" height="180" border="0" /></a> </div>
  121. <h2><a href="http://tech.163.com/special/000915SN/soft2005.html">网易学院05年软件评选结果
  122.  
  123. </a></h2>
  124. <p>经过大家的热情投票和我们的辛劳整理,网易学院2005年年度软件评选结果终于出炉啦。点击进入查看…
  125.  
  126. …<img src="/newimg/i2.gif" alt="详细" width="3" height="5" /> <a
  127.  
  128. href="http://tech.163.com/special/000915SN/soft2005.html" class="cDRed">详细</a></p>
  129. </div>
  130. <div id="focusPic2" style="display: none ;">
  131. <div class="pic"> <a href="http://tech.163.com/discover/"><img
  132.  
  133. src="http://cimg.163.com/tech/2006/1/17/200601171557008cee7.jpg" alt="颠覆丛林动物生存法则"
  134.  
  135. width="240" height="180" border="0" /></a> </div>
  136. <h2><a href="http://tech.163.com/discover/">颠覆丛林动物生存法则</a></h2>
  137. <p>群居动物的这种行为颠覆了我们通常认为的,在动物世界通行的 “丛林法则”,动物不都自私,不都是
  138.  
  139. 弱肉强食的。<img src="/newimg/i2.gif" alt="详细" width="3" height="5" /> <a
  140.  
  141. href="http://tech.163.com/discover/" class="cDRed">详细</a></p>
  142. </div>
  143. <div id="focusPic3" style="display: none ;">
  144. <div class="pic"> <a href="http://tech.163.com/special/00091MNJ/itobserve015.html"><img
  145.  
  146. src="http://cimg.163.com/tech/2006/1/17/2006011711483290a60.jpg" alt="WAPI并非贸易阴谋"
  147.  
  148. width="240" height="180" border="0" /></a> </div>
  149. <h2><a href="http://tech.163.com/special/00091MNJ/itobserve015.html">WAPI并非贸易阴谋</a></h2>
  150. <p>近日国家做出决定:“将向其他的国内及国外企业公布该算法”。事实证明中国WAPI标准并非是贸易阴谋
  151.  
  152. 。<img src="/newimg/i2.gif" alt="详细" width="3" height="5" /> <a
  153.  
  154. href="http://tech.163.com/special/00091MNJ/itobserve015.html" class="cDRed">详细</a></p>
  155. </div>
  156. <div id="focusPic4" style="display: none ;">
  157. <div class="pic"> <a href="http://tech.163.com/special/00091OSI/horizons.html"><img
  158.  
  159. src="http://cimg.163.com/tech/2006/1/17/200601171002503f251.jpg" alt="新视野号探测冥王星特别专题
  160.  
  161. " width="240" height="180" border="0" /></a> </div>
  162. <h2><a href="http://tech.163.com/special/00091OSI/horizons.html">新视野号探测冥王星特别专题
  163.  
  164. </a></h2>
  165. <p>美国宇航局将于北京时间18日凌晨2时24分发射新视野号探测器,造访这颗人类唯一尚未探测过的行星-冥
  166.  
  167. 王星。<img src="/newimg/i2.gif" alt="详细" width="3" height="5" /> <a
  168.  
  169. href="http://tech.163.com/special/00091OSI/horizons.html" class="cDRed">详细</a></p>
  170. </div>
  171. <div class="more">
  172. <div class="textNum">
  173. <div class="text">&gt; 更多头图新闻</div>
  174. <div class="num bg1" id="focusPic1nav" style="display: block;">
  175. <ul>
  176. <li>1</li>
  177. <li><a href="javascript:setFocus1(2);" target="_self">2</a></li>
  178. <li><a href="javascript:setFocus1(3);" target="_self">3</a></li>
  179. <li><a href="javascript:setFocus1(4);" target="_self">4</a></li>
  180. </ul>
  181. </div>
  182. <div class="num bg2" id="focusPic2nav" style="display: none;">
  183. <ul>
  184. <li><a href="javascript:setFocus1(1);" target="_self">1</a></li>
  185. <li>2</li>
  186. <li><a href="javascript:setFocus1(3);" target="_self">3</a></li>
  187. <li><a href="javascript:setFocus1(4);" target="_self">4</a></li>
  188. </ul>
  189. </div>
  190. <div class="num bg3" id="focusPic3nav" style="display: none;">
  191. <ul>
  192. <li><a href="javascript:setFocus1(1);" target="_self">1</a></li>
  193. <li><a href="javascript:setFocus1(2);" target="_self">2</a></li>
  194. <li>3</li>
  195. <li><a href="javascript:setFocus1(4);" target="_self">4</a></li>
  196. </ul>
  197. </div>
  198. <div class="num bg4" id="focusPic4nav" style="display: none;">
  199. <ul>
  200. <li><a href="javascript:setFocus1(1);" target="_self">1</a></li>
  201. <li><a href="javascript:setFocus1(2);" target="_self">2</a></li>
  202. <li><a href="javascript:setFocus1(3);" target="_self">3</a></li>
  203. <li>4</li>
  204. </ul>
  205. </div>
  206. </div>
  207. </div>
  208. </div>
  209. </body>
  210. </html>
复制代码
成功就是成为最好的你自己!
两年突破10万年薪 名企高薪就业
 

TOP

   

昵称: 木林森
头衔: 名誉版主

Rank: 8Rank: 8

帖子
3030 
主题
积分
8865 
在线时间
2318 小时 
最后登录
2010-12-13 

第一颗象牙第二颗象牙第三颗象牙

JavaScript经典效果集锦之五

三十一 菜单特效
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <!-- saved from url=(0046)http://vip.aou.cn/csqf/new_page_3.htm -->
  3. <HTML><HEAD><TITLE>New Page 28</TITLE>
  4. <META http-equiv=Content-Type content="text/html; charset=gb2312">
  5. <META content="MSHTML 6.00.2800.1491" name=GENERATOR>
  6. <META content=FrontPage.Editor.Document name=ProgId>
  7. <STYLE>#ssm2 A {
  8. FONT-SIZE: 12px; COLOR: #808080; FONT-FAMILY: verdana; TEXT-DECORATION: none
  9. }
  10. #ssm2 A:hover {
  11. COLOR: #ccff33
  12. }
  13. body{background:url(http://www.infowe.com/images/infowe.gif) no-repeat right center fixed;}
  14. </STYLE>
  15. </HEAD>
  16. <BODY>
  17. <SCRIPT language=JavaScript1.2>
  18.  
  19. function MM_displayStatusMsg(msgStr) {
  20.  
  21. status=msgStr;
  22.  
  23. document.MM_returnValue = true;
  24.  
  25. }
  26.  
  27. function highlight(x){
  28.  
  29. document.forms[x].elements[0].focus()
  30.  
  31. document.forms[x].elements[0].select()
  32.  
  33. }
  34.  
  35. function MM_jumpMenu(targ,selObj,restore){
  36.  
  37. eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  38.  
  39. if (restore) selObj.selectedIndex=0;
  40.  
  41. }
  42.  
  43. var NS
  44.  
  45. IE=document.all;
  46.  
  47. NS=document.layers;
  48.  
  49. hdrFontFamily="Verdana";
  50.  
  51. hdrFontSize="2";
  52.  
  53. hdrFontColor="white";
  54.  
  55. hdrBGColor="#CCCCCC";
  56.  
  57. linkFontFamily="Verdana";
  58.  
  59. linkFontSize="2";
  60.  
  61. linkBGColor="white";
  62.  
  63. linkOverBGColor="#CCCCCC";
  64.  
  65. linkTarget="_top";
  66.  
  67. YOffset=60;
  68.  
  69. staticYOffset=20;
  70.  
  71. menuBGColor="#CCCCCC";
  72.  
  73. menuIsStatic="no";
  74.  
  75. menuHeader="Main Index"
  76.  
  77. menuWidth=150; // Must be a multiple of 5!
  78.  
  79. staticMode="advanced"
  80.  
  81. barBGColor="#C0C0C0";
  82.  
  83. barFontFamily="Verdana";
  84.  
  85. barFontSize="2";
  86.  
  87. barFontColor="white";
  88.  
  89. barText="MENU";
  90.  
  91. function moveOut() {
  92.  
  93. if (window.cancel) {
  94.  
  95. cancel="";
  96.  
  97. }
  98.  
  99. if (window.moving2) {
  100.  
  101. clearTimeout(moving2);
  102.  
  103. moving2="";
  104.  
  105. }
  106.  
  107. if ((IE && ssm2.style.pixelLeft<0)||(NS && document.ssm2.left<0)) {
  108.  
  109. if (IE) {ssm2.style.pixelLeft += (5%menuWidth);
  110.  
  111. }
  112.  
  113. if (NS) {
  114.  
  115. document.ssm2.left += (5%menuWidth);
  116.  
  117. }
  118.  
  119. moving1 = setTimeout('moveOut()', 5)
  120.  
  121. }
  122.  
  123. else {
  124.  
  125. clearTimeout(moving1)
  126.  
  127. }
  128.  
  129. };
  130.  
  131. function moveBack() {
  132.  
  133. cancel = moveBack1()
  134.  
  135. }
  136.  
  137. function moveBack1() {
  138.  
  139. if (window.moving1) {
  140.  
  141. clearTimeout(moving1)
  142.  
  143. }
  144.  
  145. if ((IE && ssm2.style.pixelLeft>(-menuWidth))||(NS && document.ssm2.left>(-150))) {
  146.  
  147. if (IE) {ssm2.style.pixelLeft -= (5%menuWidth);
  148.  
  149. }
  150.  
  151. if (NS) {
  152.  
  153. document.ssm2.left -= (5%menuWidth);
  154.  
  155. }
  156.  
  157. moving2 = setTimeout('moveBack1()', 5)}
  158.  
  159. else {
  160.  
  161. clearTimeout(moving2)
  162.  
  163. }
  164.  
  165. };
  166.  
  167. lastY = 0;
  168.  
  169. function makeStatic(mode) {
  170.  
  171. if (IE) {winY = document.body.scrollTop;var NM=ssm2.style
  172.  
  173. }
  174.  
  175. if (NS) {winY = window.pageYOffset;var NM=document.ssm2
  176.  
  177. }
  178.  
  179. if (mode=="smooth") {
  180.  
  181. if ((IE||NS) && winY!=lastY) {
  182.  
  183. smooth = .2 * (winY - lastY);
  184.  
  185. if(smooth > 0) smooth = Math.ceil(smooth);
  186.  
  187. else smooth = Math.floor(smooth);
  188.  
  189. if (IE) NM.pixelTop+=smooth;
  190.  
  191. if (NS) NM.top+=smooth;
  192.  
  193. lastY = lastY+smooth;
  194.  
  195. }
  196.  
  197. setTimeout('makeStatic("smooth")', 1)
  198.  
  199. }
  200.  
  201. else if (mode=="advanced") {
  202.  
  203. if ((IE||NS) && winY>YOffset-staticYOffset) {
  204.  
  205. if (IE) {NM.pixelTop=winY+staticYOffset
  206.  
  207. }
  208.  
  209. if (NS) {NM.top=winY+staticYOffset
  210.  
  211. }
  212.  
  213. }
  214.  
  215. else {
  216.  
  217. if (IE) {NM.pixelTop=YOffset
  218.  
  219. }
  220.  
  221. if (NS) {NM.top=YOffset-7
  222.  
  223. }
  224.  
  225. }
  226.  
  227. setTimeout('makeStatic("advanced")', 1)
  228.  
  229. }
  230.  
  231. }
  232.  
  233. function init() {
  234.  
  235. if (IE) {
  236.  
  237. ssm2.style.pixelLeft = -menuWidth;
  238.  
  239. ssm2.style.visibility = "visible"
  240.  
  241. }
  242.  
  243. else if (NS) {
  244.  
  245. document.ssm2.left = -menuWidth;
  246.  
  247. document.ssm2.visibility = "show"
  248.  
  249. }
  250.  
  251. else {
  252.  
  253. alert('Choose either the "smooth" or "advanced" static modes!')
  254.  
  255. }
  256.  
  257. }
  258.  
  259. function MM_displayStatusMsg(msgStr) {
  260.  
  261. status=msgStr;
  262.  
  263. document.MM_returnValue = true;
  264.  
  265. }
  266.  
  267. </SCRIPT>
  268.  
  269. <SCRIPT language=JavaScript1.2>
  270.  
  271. if (IE) {document.write('<DIV ID="ssm2" style="visibility:hidden;Position : Absolute ;Left : 0px
  272.  
  273. ;Top : '+YOffset+'px ;Z-Index : 20;width:1px" onmouseover="moveOut()"
  274.  
  275. onmouseout="moveBack()">')}
  276.  
  277. if (NS) {document.write('<LAYER visibility="hide" top="'+YOffset+'" name="ssm2"
  278.  
  279. bgcolor="'+menuBGColor+'" left="0" onmouseover="moveOut()" onmouseout="moveBack()">')}
  280.  
  281. tempBar=""
  282.  
  283. for (i=0;i<barText.length;i++) {
  284.  
  285. tempBar+=barText.substring(i, i+1)+"<BR>"}
  286.  
  287. document.write('<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+16+2)+'"
  288.  
  289. bgcolor="'+menuBGColor+'"><tr><td bgcolor="'+hdrBGColor+'" WIDTH="'+menuWidth+'"> <font
  290.  
  291. face="'+hdrFontFamily+'" Size="'+hdrFontSize+'"
  292.  
  293. COLOR="'+hdrFontColor+'"><b>'+menuHeader+'</b></font></td><td align="center" rowspan="100"
  294.  
  295. width="16" bgcolor="'+barBGColor+'"><p align="center"><font face="'+barFontFamily+'"
  296.  
  297. Size="'+barFontSize+'" COLOR="'+barFontColor+'"><B>'+tempBar+'</B></font></p></TD></tr>')
  298.  
  299. function addItem(text, link, target) {
  300.  
  301. if (!target) {target=linkTarget}
  302.  
  303. document.write('<TR><TD BGCOLOR="'+linkBGColor+'" onmouseover="bgColor=/''+linkOverBGColor+'/'"
  304.  
  305. onmouseout="bgColor=/''+linkBGColor+'/'"><ILAYER><LAYER
  306.  
  307. onmouseover="bgColor=/''+linkOverBGColor+'/'" onmouseout="bgColor=/''+linkBGColor+'/'"
  308.  
  309. WIDTH="100%"><FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'"> <A HREF="'+link+'"
  310.  
  311. target="'+target+'" CLASS="ssm2Items">'+text+'</A></FONT></LAYER></ILAYER></TD></TR>')}
  312.  
  313. function addHdr(text) {
  314.  
  315. document.write('<tr><td bgcolor="'+hdrBGColor+'" WIDTH="140"> <font face="'+hdrFontFamily+'"
  316.  
  317. Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+text+'</b></font></td></tr>')}
  318.  
  319. //Only edit the script between HERE
  320.  
  321. addItem('偶和叶子', 'http://vip.aou.cn/csqf/about.htm', '');
  322.  
  323. addItem('聆听心海', 'http://vip.aou.cn/csqf/linting.htm', '');
  324.  
  325. addItem('风言风语', 'http://vip.aou.cn/csqf/fyfy.htm', '');
  326.  
  327. addItem('风行风影', 'http://vip.aou.cn/csqf/fxfy.htm', '');
  328.  
  329. addItem('雁过留声', 'http://csqf.etp21.com/', '_blank');
  330.  
  331. addHdr('WELCOME TO');
  332.  
  333. addItem('经广俱乐部', 'http://dj973.tz315.net', '_blank');
  334.  
  335. // and HERE! No more!
  336.  
  337. document.write('<tr><td bgcolor="'+hdrBGColor+'"><font size="0" face="Arial">
  338.  
  339. </font></td></TR></table>')
  340.  
  341. if (IE) {document.write('</DIV>')}
  342.  
  343. if (NS) {document.write('</LAYER>')}
  344.  
  345. if ((IE||NS) && (menuIsStatic=="yes"&&staticMode)) {makeStatic(staticMode);}
  346.  
  347. </SCRIPT>
  348.  
  349. <SCRIPT>
  350.  
  351. window.onload=init
  352.  
  353. </SCRIPT>
  354. <p style="height:1000px;"></p>
  355. </BODY></HTML>
复制代码


三十二 采用CSS和JS的下拉菜单
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.  
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  7. <title>nav</title>
  8. <script language="javascript">
  9. // JavaScript Document
  10.  
  11. startList = function() {
  12. if (document.all&&document.getElementById) {
  13. navRoot = document.getElementById("nav");
  14. for (i=0; i<navRoot.childNodes.length; i++) {
  15. node = navRoot.childNodes[i];
  16. if (node.nodeName=="LI") {
  17. node.onmouseover=function() {
  18. this.className+=" over";
  19. }
  20. node.onmouseout=function() {
  21. this.className=this.className.replace(" over", "");
  22. }
  23. }
  24. }
  25. }
  26. }
  27. window.onload=startList;
  28. </script>
  29. <style type="text/css">
  30. <!--
  31. body {
  32.   font: normal 11px verdana;
  33.   }
  34.  
  35. ul {
  36.   margin: 0;
  37.   padding: 0;
  38.   list-style: none;
  39.   width: 150px; /* Width of Menu Items */
  40.   border-bottom: 1px solid #ccc;
  41.   }
  42.   
  43. ul li {
  44.   position: relative;
  45.   }
  46.   
  47. li ul {
  48.   position: absolute;
  49.   left: 149px; /* Set 1px less than menu width */
  50.   top: 0;
  51.   display: none;
  52.   }
  53.  
  54. /* Styles for Menu Items */
  55. ul li a {
  56.   display: block;
  57.   text-decoration: none;
  58.   color: #777;
  59.   background: #fff; /* IE6 Bug */
  60.   padding: 5px;
  61.   border: 1px solid #ccc; /* IE6 Bug */
  62.   border-bottom: 0;
  63.   }
  64.   
  65. /* Holly Hack. IE Requirement /*/
  66. * html ul li { float: left; height: 1%; }
  67. * html ul li a { height: 1%; }
  68. /* End */
  69.  
  70. li:hover ul, li.over ul { display: block; } /* The magic */
  71. -->
  72. </style>
  73. </head>
  74.  
  75. <body>
  76. <ul id="nav">
  77. <li><a href="#">Home</a></li>
  78. <li><a href="#">About</a>
  79. <ul>
  80. <li><a href="#">History</a></li>
  81. <li><a href="#">Team</a></li>
  82. <li><a href="#">Offices</a></li>
  83. </ul>
  84. </li>
  85. <li><a href="#">Services</a>
  86. <ul>
  87. <li><a href="#">Web Design</a></li>
  88. <li><a href="#">Internet Marketing</a></li>
  89. <li><a href="#">Hosting</a></li>
  90. <li><a href="#">Domain Names</a></li>
  91. <li><a href="#">Broadband</a></li>
  92. </ul>
  93. </li>
  94. <li><a href="#">Contact Us</a>
  95. <ul>
  96. <li><a href="#">United Kingdom</a></li>
  97. <li><a href="#">France</a></li>
  98. <li><a href="#">USA</a></li>
  99. <li><a href="#">Australia</a></li>
  100. </ul>
  101. </li>
  102.  
  103. </ul>
  104. </body>
  105. </html>
复制代码
原创粉丝点击