图片循环问题!请各位大虾帮帮忙,急啊!!!!!!
当我把JSP11.jsp,与JSP12.jsp放在同一个页面时,JSP12.jsp里的循环图片就只能循环3张,单独放时JSP12.jsp里的循环图片就可以全部循环,我认为是受JSP11.jsp里的setTimeout影响了,我想了好久都没有改出来,请各位大虾帮帮忙,分不够我可以在加
JSP1.jsp
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
jsp6
</title>
</head>
<body bgcolor="#ffffff">
<jsp:include flush="" page="jsp10.jsp" />
<jsp:include flush="" page="jsp11.jsp" />
</form>
</body>
</html>
JSP10.jsp
<%@ page contentType="text/html; charset=GBK" %>
<script>
var bannerAD = new Array();
var bannerADlink = new Array();
var bannerADinfo = new Array();
var adNum = -1;
bannerAD[0] ="CAL7GGGRXC/right_11.gif" ;
bannerADlink[0] = "N9O9IGPb2E.jsp?Id=B000000281" ;
bannerADinfo[0] = "aaaaaaaaa";
bannerAD[1] = "CAL7GGGRXC/logo1.jpg";
bannerADlink[1] = "http://10.0.2.9/info/list.jsp?Id=B000000200";
bannerADinfo[1] = "bbbbbbb";
function nextAd(){
if (adNum != -1) clearTimeout(theTimer);
if(adNum<bannerAD.length-1)adNum++ ;
else adNum=0;
document.all.bannerpic.src = bannerAD[adNum];
ele = document.getElementById("p"+eval(adNum));
clearbg();
ele.bgColor="red";
theTimer=setTimeout("nextAd()", 15000);
}
function cAd(){
ele = document.getElementById("p"+eval(adNum));
clearbg();
ele.bgColor="red";
theTimer2=setTimeout("cAd()", 1000);
}
function clearbg()
{
for (i=0;i<bannerAD.length;i++)document.getElementById("p"+eval(i)).bgColor="";
}
function jump2url()
{
jumpUrl=bannerADlink[adNum];
jumpTarget="_blank";
if (jumpUrl != '') {
if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
else location.href=jumpUrl;
}
}
</script>
<table cellspacing=1 cellpadding=0 width=770 align=center border=0 style=font-size:12px>
<tr><td valign=top align=right >
<img id="bannerpic" src="#" onclick="jump2url()" style="cursor:hand;width:770px;height:70px border=0"><br>
<table cellspacing=1 cellpadding=0 style="position:relative;font-size:14px;font-family:Arial;font-weight:bold;color:white;cursor:hand;FILTER:Alpha(Opacity=50);top:-16px" bgcolor=white border=0>
<tr bgcolor=black >
<script>
{
for (k=0;k<bannerAD.length;k++)
{
prek = k - 1;
if (k==-1){prek=bannerAD.length;}
document.write("<td width='30px' height='5px' id=p"+eval(k)+" align='center' onclick=\"adNum='"+eval(prek)+"';clearTimeout(theTimer);nextAd()\" valign=top><a title='"+bannerADinfo[k]+"'>"+eval(k+1)+"<br></a>")
}
}
</script>
</tr>
</table>
</table>
<script>
{
nextAd();
cAd();
}
</script>
jsp11.jsp
<%@ page contentType="text/html; charset=GBK" %>
<script language="JavaScript1.2">
var scrollerwidth='300px'
var scrollerheight='250px'
var scrollerbgcolor='white'
var pausebetweenimages=1000
var slideimages=new Array()
slideimages[0]='<img src=CAL7GGGRXC/2008052602.jpg width=280 height=210><br><table width=300><tr><td align=center>1 </td></tr></table>'
slideimages[1]='<img src=CAL7GGGRXC/2008052601.jpg width=280 height=210><br><table width=300><tr><td align=center>2</td></tr></table>'
slideimages[2]='<img src=CAL7GGGRXC/2008052301.jpg width=280 height=210><br><table width=300><tr><td align=center>3</td></tr></table>'
slideimages[3]='<img src=CAL7GGGRXC/2008011702.jpg width=280 height=210><br><table width=300><tr><td align=center>4</td></tr></table>'
slideimages[4]='<img src=../../info/RMKALSGK8V/a01.jpg width=280 height=210><br><table width=300><tr><td align=center>5</td></tr></table>'
slideimages[5]='<img src=../../info/RMKALSGK8V/a02.jpg width=280 height=210><br><table width=300><tr><td align=center>6</td></tr></table>'
slideimages[6]='<img src=../../info/RMKALSGK8V/a03.jpg width=280 height=210><br><table width=300><tr><td align=center>7</td></tr></table>'
slideimages[7]='<img src=../../info/RMKALSGK8V/a04.jpg width=280 height=210><br><table width=300><tr><td align=center>8</td></tr></table>'
slideimages[8]='<img src=../../info/RMKALSGK8V/a05.jpg width=280 height=210><br><table width=300><tr><td align=center>9</td></tr></table>'
var ie=document.all
var dom=document.getElementById
if (slideimages.length>1)
i=2
else
i=0
function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.left>0&&tlayer.left<=5){
tlayer.left=0
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (tlayer.left>=tlayer.document.width*-1){
tlayer.left-=5
setTimeout("move1(tlayer)",50)
}
else{
tlayer.left=parseInt(scrollerwidth)+5
tlayer.document.write(slideimages[i])
tlayer.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.left>0&&tlayer2.left<=5){
tlayer2.left=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.left>=tlayer2.document.width*-1){
tlayer2.left-=5
setTimeout("move2(tlayer2)",50)
}
else{
tlayer2.left=parseInt(scrollerwidth)+5
tlayer2.document.write(slideimages[i])
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move3(whichdiv){
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.left)>0&&parseInt(tdiv.style.left)<=5){
tdiv.style.left=0+"px"
setTimeout("move3(tdiv)",pausebetweenimages)
setTimeout("move4(scrollerdiv2)",pausebetweenimages)
return
}
if (parseInt(tdiv.style.left)>=tdiv.offsetWidth*-1){
tdiv.style.left=parseInt(tdiv.style.left)-5+"px"
setTimeout("move3(tdiv)",50)
}
else{
tdiv.style.left=scrollerwidth
tdiv.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.left)>0&&parseInt(tdiv2.style.left)<=5){
tdiv2.style.left=0+"px"
setTimeout("move4(tdiv2)",pausebetweenimages)
setTimeout("move3(scrollerdiv1)",pausebetweenimages)
return
}
if (parseInt(tdiv2.style.left)>=tdiv2.offsetWidth*-1){
tdiv2.style.left=parseInt(tdiv2.style.left)-5+"px"
setTimeout("move4(scrollerdiv2)",50)
}
else{
tdiv2.style.left=scrollerwidth
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function startscroll(){
if (ie||dom){
scrollerdiv1=ie? first2 : document.getElementById("first2")
scrollerdiv2=ie? second2 : document.getElementById("second2")
move3(scrollerdiv1)
scrollerdiv2.style.left=scrollerwidth
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.left=parseInt(scrollerwidth)+5
document.main.document.second.visibility='show'
}
}
window.onload=startscroll
</script>
<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight}; bgColor=&{scrollerbgcolor}; visibility=hide>
<layer id="first" left=1 top=0 width=&{scrollerwidth}; >
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[0])
</script>
</layer>
<layer id="second" left=0 top=0 width=&{scrollerwidth}; visibility=hide>
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[1])
</script>
</layer>
</ilayer>
<script language="JavaScript1.2">
if (ie||dom){
document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+'">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:1px;top:0px;">')
document.write(slideimages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px">')
document.write(slideimages[1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</div>')
}
</script>