图片广告切换问题。
pupco 2011-04-29 10:43:34 大家好!!
下面是一段代码:
$(document).ready(function() {
$("img#advsheadlbpic_0").show();
setInterval("$().advsHeadLbRoll()", 5000);
(function($){
$.fn.advsHeadLbRoll = function(){
var rollobj=$(".advsheadlbpic");
var rolltotal=parseInt(rollobj.size())-1;
var nextId,nowId;
$("img.advsheadlbpic").each(function(){
if(this.style.display=='block' || this.style.display=='inline'){
nowId=parseInt(this.id.substr(14));
if(nowId>=rolltotal){
nextId=0;
}else{
nextId=nowId+1;
}
}
});
$("img#advsheadlbpic_"+nextId).fadeIn('slow').show('slow');
$("img#advsheadlbpic_"+nowId).fadeOut('slow').hide();
};
})(jQuery);
});
在 .aspx* 调用:
<head id="Head1" runat="server">
<title>首页</title>
<script src ="/js/advsheadlb.js" type ="text/javascript" ></script>
</head>
在div里要显示的图片广告:
<div id="advsheadlb">
<img id="advsheadlbImages_0" class="advsheadlbpic" border="0" src="Images/1285659686.jpg"alt =""/>
<img id="advsheadlbImages_1" class="advsheadlbpic" border="0" src="Images/1285659690.jpg" alt =""/>
</div>
页面运行的时候图片不显示? 以上代码哪里出错 了呢?
求解!!!!!
谢谢。。