国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

JS實現的新聞列表自動滾動效果示例

2019-11-19 12:11:41
字體:
來源:轉載
供稿:網友

本文實例講述了JS實現的新聞列表自動滾動效果。分享給大家供大家參考,具體如下:

<!DOCTYPE html><html lang="en"><head>  <meta charset="UTF-8">  <title>Title</title>  <style type="text/css">    #box{width:260px;height:100px;margin:0 auto;border:2px solid red;overflow: hidden}    ul{padding:0;margin:0;list-style: none;overflow: hidden}    ul li{height:24px;line-height: 24px;padding-left:10px;}    a{text-decoration: none;color:#000;}    a:hover{color:#f00}  </style></head><body><div id="box">  <ul id="con1" onMouseOut="Up()" onMouseOver="Stop()">    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >1,課程html</a> </li>    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >2,課程css</a> </li>    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >3,課程js</a> </li>    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >4,課程jquery</a> </li>    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >5,課程html5</a> </li>    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >6,課程css3</a> </li>    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >7,課程hp</a> </li>    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >8,課程bpootstrap</a> </li>    <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >9,課程apicloud</a> </li>  </ul>  <ul id="con2"></ul></div></body><script type="text/javascript">  var box=document.getElementById("box");  var con1=document.getElementById("con1");  var con2=document.getElementById("con2");  var s=document.getElementsByTagName("a");  var speed=50;  con2.innerHTML=con1.innerHTML;  function ScrollUp(){    if( box.scrollTop>=con1.scrollHeight){      box.scrollTop=0;    }else      box.scrollTop++;  }  var i=setInterval("ScrollUp()",speed);  function Stop(){    clearInterval(i);  }  function Up(){    i=setInterval("ScrollUp()",speed);  }</script></html>

這里使用在線HTML/CSS/JavaScript代碼運行工具http://tools.VeVB.COm/code/HtmlJsRun測試上述代碼,可得如下運行效果:

更多關于JavaScript相關內容感興趣的讀者可查看本站專題:《JavaScript切換特效與技巧總結》、《JavaScript查找算法技巧總結》、《JavaScript錯誤與調試技巧總結》、《JavaScript數據結構與算法技巧總結》、《JavaScript遍歷算法與技巧總結》及《JavaScript數學運算用法總結

希望本文所述對大家JavaScript程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 安龙县| 托克逊县| 绥宁县| 邹城市| 贵定县| 高邑县| 左权县| 彭州市| 多伦县| 东海县| 美姑县| 高陵县| 兴城市| 于都县| 衡南县| 分宜县| 东安县| 青川县| 石城县| 井研县| 新河县| 娄底市| 黄平县| 沙田区| 周口市| 桐梓县| 扶余县| 枣庄市| 贵定县| 汽车| 滦南县| 永顺县| 苏尼特左旗| 和田县| 松滋市| 宝坻区| 荣成市| 岳池县| 靖远县| 黔西| 清水河县|