<div class="htmlarea"> <textarea id="runcode9611"> <style type="text/css"> /* 图片新闻大小可以更改此样式 */ .pp_portal_imgNews { position:relative; text-align:left; width:250px; height:190px; } .pp_portal_imgNew { position:absolute; } /* 图片样式 */ .pp_portal_imgNew img { width:100%; height:165px; border:0; } /* 文字标题样式 */ .pp_portal_imgNew_title { text-align:center; margin-top:5px; } .pp_portal_imgNew_title a{ display:block; color:#000; text-decoration: none; font-size: 14px; font-weight: bold; text-align:center; } /* 导航提示位置 */ .pp_portal_navLink { position:absolute; display:block; right:0px; bottom:5px; } /* 导航提示样式(未选择) */ .pp_portal_navLink a { color:#fff; text-align:center; text-decoration: none; } .pp_portal_navLink li { display:inline; text-align:center; background-color:#333; width:15px; margin-left:1px; } </style> <div id="id_portal_imgNews" class="pp_portal_imgNews"> <div id="id_portal_imgNew1" class="pp_portal_imgNew" style="display:block;"> <a href="#"> <img alt="Javascript CSS实现Flash动态新闻效果(pp原创)_图象特效" src="http://files.jb51.net/upload/20081011185509111.jpg"></a><div class="pp_portal_imgNew_title"> <a href="http://sports.sina.com.cn/f1/2008-10-11/14014001153.shtml"></a>Javascript CSS实现Flash动态新闻效果(pp原创)_图象特效</div> </div> <div id="id_portal_imgNew2" class="pp_portal_imgNew" style="display:none;"> <a href="#"> <img alt="Javascript CSS实现Flash动态新闻效果(pp原创)_图象特效" src="http://files.jb51.net/upload/20081011185509111.jpg"></a><div class="pp_portal_imgNew_title"> <a href="http://sports.sina.com.cn/f1/2008-10-11/14014001153.shtml"></a>Javascript CSS实现Flash动态新闻效果(pp原创)_图象特效</div> </div> <div id="id_portal_imgNew3" class="pp_portal_imgNew" style="display:none;"> <a href="#"> <img alt="Javascript CSS实现Flash动态新闻效果(pp原创)_图象特效" src="http://files.jb51.net/upload/20081011185509111.jpg"></a><div class="pp_portal_imgNew_title"> <a href="http://sports.sina.com.cn/f1/2008-10-11/14014001153.shtml"></a>Javascript CSS实现Flash动态新闻效果(pp原创)_图象特效</div> </div> <div id="id_portal_imgNew4" class="pp_portal_imgNew" style="display:none;"> <a href="#"> <img alt="Javascript CSS实现Flash动态新闻效果(pp原创)_图象特效" src="http://files.jb51.net/upload/20081011185509111.jpg"></a><div class="pp_portal_imgNew_title"> <a href="http://sports.sina.com.cn/f1/2008-10-11/14014001153.shtml"></a>Javascript CSS实现Flash动态新闻效果(pp原创)_图象特效</div> </div> <div id="id_portal_navLinks" class="pp_portal_navLink"> <ul> <li id="id_portal_navLink1"> <a href="javascript:void(0)" onclick="pp_portal_selectPicNew(1)"></a> 1 </li> <li id="id_portal_navLink2"> <a href="javascript:void(0)" onclick="pp_portal_selectPicNew(2)"></a> 2 </li> <li id="id_portal_navLink3"> <a href="javascript:void(0)" onclick="pp_portal_selectPicNew(3)"></a> 3 </li> <li id="id_portal_navLink4"> <a href="javascript:void(0)s" onclick="pp_portal_selectPicNew(4)"></a> 4 </li> </ul> </div> </div> </textarea> <br><input onclick="runEx('runcode9611')" type="button" value="运行代码"><input onclick="doCopy('runcode9611')" type="button" value="复制代码"> <input onclick="doSave(runcode9611)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 全选 注:</a>如需引入外部Js需刷新才能执行</div>]<script type="text/javascript"> var newsNum = 4; var nn = 1; function pp_portal_selectPicNew(o) { for(var i=1; i<=newsNum; i++) { var newsId = "id_portal_imgNew" + i; if(o==i) { // 被选中 document.getElementById(newsId).style.display="block"; document.getElementById("id_portal_navLink"+i).style.background="red"; } else { document.getElementById(newsId).style.display="none"; document.getElementById("id_portal_navLink"+i).style.background="#333"; } } nn=o; } // 自动选择图片新闻 function pp_portal_changePicNew() { if(nn>newsNum) nn=1 //alert(nn); pp_portal_selectPicNew(nn); nn++; } function pp_portal_picNew_auto() { pp_portal_picNew_autoTask = setInterval('pp_portal_changePicNew()', 2000); } pp_portal_picNew_auto(); </script>