<div class="htmlarea"><textarea id="runcode11231"> <style type="text/css"> <!-- body{text-align:center;} table{width:500px; margin:0px auto;} td{padding:5px; font-weight:bold; text-align:center;} .iborder{border:1px #333333 solid; margin-top:5px;} .topnavon{background:#FFCC00; cursor:pointer;} .topnavoff{background:#000000; color:#FFFFFF;} --> </style> <h1 align="center" style="color:#FF0000;"> </h1>자동 슬라이딩 마우스 슬라이딩 영역<div align="center" style="color:#FF0000;"> </div>10초만에 자동 점프<table width="100%" border="0" cellspacing="0" cellpadding="0" class="iborder"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="topnavon" id="clipNum1" onmouseover="clip_Switch(1); return false;">热点聚焦</td> <td class="topnavoff" id="clipNum2" onmouseover="clip_Switch(2); return false;">图说新闻</td> <td class="topnavoff" id="clipNum3" onmouseover="clip_Switch(3); return false;">经济新闻</td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td id="newsbox1" style="display:block;"><h1>新闻1</h1></td> </tr> <tr> <td id="newsbox2" style="display:none;"><h1>新闻2</h1></td> </tr> <tr> <td id="newsbox3" style="display:none;"><h1>新闻3</h1></td> </tr> </table> <table width="100%" border="0" cellpacing="0" cellpadding="0"> <tr> <td id="newsbox1" style="display:block;"><h1>뉴스 1</h1></td> </tr> </table> </td> </tr> <tr> <td id="newsbox2" style="display:none;"> <h1>뉴스2<div align="center" style="color:#FF0000;"></div> </h1> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="iborder"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="topnavon" id="ecNav1" onmouseover="ecNavOn(1); return false;">财经要闻</td> <td class="topnavoff" id="ecNav2" onmouseover="ecNavOn(2); return false;">财经观察</td> <td class="topnavoff" id="ecNav3" onmouseover="ecNavOn(3); return false;">独家点评</td> <td class="topnavoff" id="ecNav4" onmouseover="ecNavOn(4); return false;">湘股在线</td> <td class="topnavoff" id="ecNav5" onmouseover="ecNavOn(5); return false;">财富排行榜</td> </tr> </table> </td> </tr> <tr> <td id="newsbox3" style="display:none;"> <h1>뉴스 3</h1> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td id="ecBox1" style="display:block;"><h1>财经1</h1></td> </tr> <tr> <td id="ecBox2" style="display:none;"><h1>财经2</h1></td> </tr> <tr> <td id="ecBox3" style="display:none;"><h1>财经3</h1></td> </tr> <tr> <td id="ecBox4" style="display:none;"><h1>财经4</h1></td> </tr> <tr> <td id="ecBox5" style="display:none;"><h1>财经5</h1></td> </tr> </table> </td> </tr> </table> <h1 align="center" style="color:#FFCC00; font-size:150px; margin:0px auto;"> </h1> <p style="font-size:12px; text-align:left;"> <span style="color:#FF0000;"> </span>5초만에 자동 점프</p> <table width="100%" border="0" cellpacing="0" cellpadding="0" class="iorder"> <tr> <td> <table width="100%" border="0" cellpacing="0" cellpadding="0"> <tr> <td class="topnavon" id="ecNav1" onmouseover="ecNavOn(1); return false;">금융 뉴스 </td> <td class="topnavoff" id="ecNav2" onmouseover="ecNavOn(2); return false;">재무 관찰<br> </td> <td class="topnavoff" id="ecNav3" onmouseover="ecNavOn(3); return false;">독점 리뷰<input onclick="runEx('runcode11231')" type="button" value="运行代码"> </td> <td class="topnavoff" id="ecNav4" onmouseover="ecNavOn(4); return false;">Xianggu 온라인<input onclick="doCopy('runcode11231')" type="button" value="复制代码"> </td> <td class="topnavoff" id="ecNav5" onmouseover="ecNavOn(5); return false;">자산 순위<input onclick="doSave(runcode11231)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank"> </a> <table width="100%" border="0" cellpacing="0" cellpadding="0"> <tr> <td id="ecBox1" style="display:block;"><h1>금융 1<br> <br> <tr> <td id="ecBox2" style="display:none;"><h1>금융 2<div class="htmlarea"><textarea id="runcode2945"> <style type="text/css"> <!-- body{text-align:center;} table{width:500px; margin:0px auto;} td{padding:5px; font-weight:bold; text-align:center;} .iborder{border:1px #333333 solid; margin-top:5px;} .topnavon{background:#FFCC00; cursor:pointer;} .topnavoff{background:#000000;color:#FFFFFF;} --> </style> <tr> <td id="ecBox3" style="display:none;"> <h1>금융 3<h1 align="center" style="color:#FF0000;"></h1> </h1> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="iborder"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="topnavon" id="clipNum1" onmouseover="clip_Switch('clipNum','newsbox',1,3); return false;">热点聚焦</td> <td class="topnavoff" id="clipNum2" onmouseover="clip_Switch('clipNum','newsbox',2,3); return false;">图说新闻</td> <td class="topnavoff" id="clipNum3" onmouseover="clip_Switch('clipNum','newsbox',3,3); return false;">经济新闻</td> </tr> </table> </td> </tr> <tr> <td id="ecBox4" style="display:none;"><h1>금융 4<script language="javascript"> <!-- /*新闻栏目播放*/ var scrollNewsCt=1; var pauseTime=10*1000; var timer0; function hideAllClips() { for (i=1; i<4; i++){ var allClips="newsbox"+i; var clipNum="clipNum"+i; document.getElementById(allClips).style.display="none"; document.getElementById(clipNum).className="topnavoff"; } } function clip_Switch(n) { var curClip="newsbox"+n; var curClipNum="clipNum"+n; hideAllClips(); document.getElementById(curClip).style.display="block"; document.getElementById(curClipNum).className="topnavon"; scrollNewsCt=n; } function fwdScroll() { stopScroll(); clip_Switch(scrollNewsCt); scrollNewsCt+=1; if (scrollNewsCt==4) { scrollNewsCt=1; } timer0=setTimeout("fwdScroll()",pauseTime); } function stopScroll() { clearTimeout(timer0); } /*财经栏目播放*/ var scrollEcCt=1; var EcpauseTime=5*1000; var timerEc; function hideAllEcClips() { for (i=1; i<6; i++){ var allEcBoxs="ecBox"+i; var ecNavNum="ecNav"+i; document.getElementById(allEcBoxs).style.display="none"; document.getElementById(ecNavNum).className="topnavoff"; } } function ecNavOn(n) { var curEcBox="ecBox"+n; var curEcNavNum="ecNav"+n; hideAllEcClips(); document.getElementById(curEcBox).style.display="block"; document.getElementById(curEcNavNum).className="topnavon"; scrollEcCt=n; } function fecScroll() { stopEcScroll(); ecNavOn(scrollEcCt); scrollEcCt+=1; if (scrollEcCt==6) { scrollEcCt=1; } timerEc=setTimeout("fecScroll()",EcpauseTime); } function stopEcScroll() { clearTimeout(timerEc); } --> </script><script language="javascript">fwdScroll();</script> <script language="javascript">fecScroll();</script> <tr> <td id="ecBox5" style="display:none;"> <h1>금융 5<script type="text/javascript"> /*栏目播放*/ var scrollNo=1; var SetTime=5*1000; var SetTimer; //clip:标签ID,box:版面ID,n:当前滑动项,m:滑动总数 function hideAllClips(clip,box,n,m) { for (i=1; i<(m+1); i++){ var allClips=box.toString()+i; var clipNum=clip.toString()+i; //alert("隐藏"+allClips); //if(i=n) break; document.getElementById(allClips).style.display="none"; document.getElementById(clipNum).className="topnavoff"; } } function clip_Switch(clip,box,n,m) { var curClip=box.toString()+n; var curClipNum=clip.toString()+n; //alert("当前"+curClip); hideAllClips(clip,box,n,m); document.getElementById(curClip).style.display="block"; document.getElementById(curClipNum).className="topnavon"; scrollNo=n; } function fwdScroll(clip,box,m) { stopScroll(); clip_Switch(clip,box,scrollNo,m); scrollNo+=1; if (scrollNo==m+1){ scrollNo=1; } SetTimer=setTimeout("fwdScroll('"+clip+"','"+box+"',"+m+")",SetTime); } function stopScroll() { clearTimeout(SetTimer); } --> </script><script language="javascript">fwdScroll('clipNum','newsbox',3);</script> <script language="javascript">fwdScroll('ecNav','ecBox',5);</script> <script language="javascript">fwdScroll('bcNav','bcBox',5);</script> <script type="text/javascript"> /*栏目播放*/ var scrollNo=0; var SetTime=5*1000; var SetTimer; function hideAllClips(clip,box,m) { for (i=1; i<(m+1); i++){ var allClips=box.toString()+i; var clipNum=clip.toString()+i; //alert("隐藏"+allClips); document.getElementById(allClips).style.display="none"; document.getElementById(clipNum).className="topnavoff"; } } function clip_Switch(clip,box,no,m) { var curClip=box.toString()+no; var curClipNum=clip.toString()+no; //alert("当前"+curClip); hideAllClips(clip,box,m); document.getElementById(curClip).style.display="block"; document.getElementById(curClipNum).className="topnavon"; scrollNo=no; } function fwdScroll(clip,box,m) { stopScroll(); clip_Switch(scrollNo); scrollNo+=0; if (scrollNo==m) { scrollNo=0; } SetTimer=setTimeout("fwdScroll(clip,box,m)",SetTime); } function stopScroll() { clearTimeout(SetTimer); } --> </script> <script language="javascript">fwdScroll('clipNum','newsbox',3);</script> <script language="javascript">fwdScroll('ecNav','ecBox',5);</script> ! 이 효과는 좋지만 페이지에 이러한 효과가 여러 개 있으면 각 부분에 JS 함수를 여러 개 작성하는 것은 어리석은 일입니다. 사실 컨트롤 이름만 다릅니다. 전문가분들께서 일반 기능이나 클래스로 개선해 달라고 불러주시면 정말 감사하겠습니다. [Ctrl A 모두 선택 참고: 외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다. ]하지만 이것은 잘 작동합니다. 페이지에 이러한 효과가 여러 개 있는 경우 각 부분에 대해 여러 JS 함수를 작성하는 것은 어리석은 일입니다. 사실 컨트롤 이름만 다를 뿐인데 전문가가 공통 함수나 클래스로 개선해줬으면 좋겠습니다. 자동 슬라이딩 마우스 슬라이딩 영역 </h1> <table width="100%" border="0" cellpacing="0" cellpadding="0" class="iorder"> <tr> <td> <table width="100%" border="0" cellpacing="0" cellpadding="0"> <tr> <td class="topnavon" id="clipNum1" onmouseover="clip_Switch('clipNum','newsbox',1,3); return false;">핫스팟 </td> <td class="topnavoff" id="clipNum2" onmouseover="clip_Switch('clipNum','newsbox',2,3); return false;">사진 뉴스 </td> <td class="topnavoff" id="clipNum3" onmouseover="clip_Switch('clipNum','newsbox',3,3); return false;">경제 뉴스 <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td id="newsbox1" style="display:block;"><h1>新闻1</h1></td> </tr> <tr> <td id="newsbox2" style="display:none;"><h1>新闻2</h1></td> </tr> <tr> <td id="newsbox3" style="display:none;"><h1>新闻3</h1></td> </tr> </table> </td> </tr> </table> <script language="javascript">fwdScroll('clipNum','newsbox',3);</script> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="iborder"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="topnavon" id="ecNav1" onmouseover="clip_Switch('ecNav','ecBox',1,5); return false;">财经要闻</td> <td class="topnavoff" id="ecNav2" onmouseover="clip_Switch('ecNav','ecBox',2,5); return false;">财经观察</td> <td class="topnavoff" id="ecNav3" onmouseover="clip_Switch('ecNav','ecBox',3,5); return false;">独家点评</td> <td class="topnavoff" id="ecNav4" onmouseover="clip_Switch('ecNav','ecBox',4,5); return false;">湘股在线</td> <td class="topnavoff" id="ecNav5" onmouseover="clip_Switch('ecNav','ecBox',5,5); return false;">财富排行榜</td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td id="ecBox1" style="display:block;"><h1>财经1</h1></td> </tr> <tr> <td id="ecBox2" style="display:none;"><h1>财经2</h1></td> </tr> <tr> <td id="ecBox3" style="display:none;"><h1>财经3</h1></td> </tr> <tr> <td id="ecBox4" style="display:none;"><h1>财经4</h1></td> </tr> <tr> <td id="ecBox5" style="display:none;"><h1>财经5</h1></td> </tr> </table> </td> </tr> </table> <script language="javascript">fwdScroll('ecNav','ecBox',5);</script> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="iborder"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="topnavon" id="bcNav1" onmouseover="clip_Switch('bcNav','bcBox',1,5); return false;">财经要闻</td> <td class="topnavoff" id="bcNav2" onmouseover="clip_Switch('bcNav','bcBox',2,5); return false;">财经观察</td> <td class="topnavoff" id="bcNav3" onmouseover="clip_Switch('bcNav','bcBox',3,5); return false;">独家点评</td> <td class="topnavoff" id="bcNav4" onmouseover="clip_Switch('bcNav','bcBox',4,5); return false;">湘股在线</td> <td class="topnavoff" id="bcNav5" onmouseover="clip_Switch('bcNav','bcBox',5,5); return false;">财富排行榜</td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td id="bcBox1" style="display:block;"><h1>财经1</h1></td> </tr> <tr> <td id="bcBox2" style="display:none;"><h1>财经2</h1></td> </tr> <tr> <td id="bcBox3" style="display:none;"><h1>财经3</h1></td> </tr> <tr> <td id="bcBox4" style="display:none;"><h1>财经4</h1></td> </tr> <tr> <td id="bcBox5" style="display:none;"><h1>财经5</h1></td> </tr> </table> </td> </tr> </table> <script language="javascript">fwdScroll('bcNav','bcBox',5);</script> <h1 align="center" style="color:#FFCC00; font-size:150px; margin:0px auto;">!</h1> <p style="font-size:12px; text-align:left;"> 改了下,能够实现了,但是第二个为什么会默认第二个项开始,第三个从第三项开始呢?而且只有最后一个自动播放,前面的都死了;并且代码还是不够精练,请高手帮忙继续修改。 </p> <br><input onclick="runEx('runcode2945')" type="button" value="运行代码"> <input onclick="doCopy('runcode2945')" type="button" value="复制代码"> <input onclick="doSave(runcode2945)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]<br><div class="htmlarea"> <textarea id="runcode80919"> <style type="text/css"> <!-- body{text-align:center;} table{width:500px; margin:0px auto;} td{padding:5px; font-weight:bold; text-align:center;} .iborder{border:1px #333333 solid; margin-top:5px;} .topnavon{background:#FFCC00; cursor:pointer;} .topnavoff{background:#000000; color:#FFFFFF;} --> </style> <script type="text/javascript"> /*栏目播放*/ var scrollNo=0; var SetTime=5*1000; var SetTimer; function hideAllClips(clip,box,m) { for (i=1; i<(m+1); i++){ var allClips=box.toString()+i; var clipNum=clip.toString()+i; //alert("隐藏"+allClips); document.getElementById(allClips).style.display="none"; document.getElementById(clipNum).className="topnavoff"; } } function clip_Switch(clip,box,no,m) { var curClip=box.toString()+no; var curClipNum=clip.toString()+no; //alert("当前"+curClip); hideAllClips(clip,box,m); document.getElementById(curClip).style.display="block"; document.getElementById(curClipNum).className="topnavon"; scrollNo=no; } function fwdScroll(clip,box,m) { stopScroll(); clip_Switch(scrollNo); scrollNo+=0; if (scrollNo==m) { scrollNo=0; } SetTimer=setTimeout("fwdScroll(clip,box,m)",SetTime); } function stopScroll() { clearTimeout(SetTimer); } --> </script> <h1 align="center" style="color:#FF0000;">自动滑动+鼠标滑动区域</h1> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="iborder"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="topnavon" id="clipNum1" onclick="clip_Switch('clipNum','newsbox',1,3); return false;">热点聚焦</td> <td class="topnavoff" id="clipNum2" onclick="clip_Switch('clipNum','newsbox',2,3); return false;">图说新闻</td> <td class="topnavoff" id="clipNum3" onclick="clip_Switch('clipNum','newsbox',3,3); return false;">经济新闻</td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td id="newsbox1" style="display:block;"><h1>新闻1</h1></td> </tr> <tr> <td id="newsbox2" style="display:none;"><h1>新闻2</h1></td> </tr> <tr> <td id="newsbox3" style="display:none;"><h1>新闻3</h1></td> </tr> </table> </td> </tr> </table> <script language="javascript">fwdScroll('clipNum','newsbox',3);</script> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="iborder"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="topnavon" id="ecNav1" onclick="clip_Switch('ecNav','ecBox',1,5); return false;">财经要闻</td> <td class="topnavoff" id="ecNav2" onclick="clip_Switch('ecNav','ecBox',2,5); return false;">财经观察</td> <td class="topnavoff" id="ecNav3" onclick="clip_Switch('ecNav','ecBox',3,5); return false;">独家点评</td> <td class="topnavoff" id="ecNav4" onclick="clip_Switch('ecNav','ecBox',4,5); return false;">湘股在线</td> <td class="topnavoff" id="ecNav5" onclick="clip_Switch('ecNav','ecBox',5,5); return false;">财富排行榜</td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td id="ecBox1" style="display:block;"><h1>财经1</h1></td> </tr> <tr> <td id="ecBox2" style="display:none;"><h1>财经2</h1></td> </tr> <tr> <td id="ecBox3" style="display:none;"><h1>财经3</h1></td> </tr> <tr> <td id="ecBox4" style="display:none;"><h1>财经4</h1></td> </tr> <tr> <td id="ecBox5" style="display:none;"><h1>财经5</h1></td> </tr> </table> </td> </tr> </table> <script language="javascript">fwdScroll('ecNav','ecBox',5);</script> <h1 align="center" style="color:#FFCC00; font-size:150px; margin:0px auto;">!</h1> <p style="font-size:12px; text-align:left;"> </p> <h1 align="center" style="color:#FF0000;">改过以后不自动播放了。</h1> </textarea><br><input onclick="runEx('runcode80919')" type="button" value="运行代码"> <input onclick="doCopy('runcode80919')" type="button" value="复制代码"> <input onclick="doSave(runcode80919)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div> </td> </tr> </table> </td> </tr> </h1></td> </tr> </table> </td> </tr></textarea></div> </h1></td> </tr> </h1></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table></textarea></div>