|
net flash图片切换
<script language="JavaScript" type="text/javascript">
var nn;
nn=0;
setTimeout('change_img()',2000);
function change_img()
{
if(nn>=<%=PicNum %>) nn=0
setTimeout('setFocus1('+nn+')',2000);
nn++;
tt=setTimeout('change_img()',2000);
}
function setFocus1(i)
{
selectLayer1(i);
}
function selectLayer1(i)
{
for(var j=0;j<<%=PicNum %>;j++)
{
if(i=j)
{
document.getElementById("focusPic"+j).style.display="block";
}
else
{
document.getElementById("focusPic"+j).style.display="none";
}
}
}
</script>
PicNum 是我从数据库调出来的新闻记录数
以下是论坛关于图片切换某个帖子的脚本,运行是没有错误:
<script language="JavaScript" type="text/javascript">
var nn;
nn=1;
setTimeout('change_img()',2000);
function change_img()
{
if(nn>4) nn=1
setTimeout('setFocus1('+nn+')',2000);
nn++;
tt=setTimeout('change_img()',2000);
}
function setFocus1(i)
{
selectLayer1(i);
}
function selectLayer1(i)
{
switch(i)
{
case 1:
document.getElementById("focusPic1").style.display="block";
document.getElementById("focusPic2").style.display="none";
document.getElementById("focusPic3").style.display="none";
document.getElementById("focusPic4").style.display="none";
break;
case 2:
document.getElementById("focusPic1").style.display="none";
document.getElementById("focusPic2").style.display="block";
document.getElementById("focusPic3").style.display="none";
document.getElementById("focusPic4").style.display="none";
break;
case 3:
document.getElementById("focusPic1").style.display="none";
document.getElementById("focusPic2").style.display="none";
document.getElementById("focusPic3").style.display="block";
document.getElementById("focusPic4").style.display="none";
break;
case 4:
document.getElementById("focusPic1").style.display="none";
document.getElementById("focusPic2").style.display="none";
document.getElementById("focusPic3").style.display="none";
document.getElementById("focusPic4").style.display="block";
break;
}
}
</script> |
|