我做了一个图片自动切换的测试 结果不成功 不知道那里有错误 可否帮看看 程序如下:
<html><head></head><body>
<table align=center width="237">
<tr>
<td>
<table width="99%" height="100%" border="0" cellspacing="0" cellspadding="0">
<tr><td colspan="6">
<font size="6">
<div id="b2bContent" style="filter: revealTrans(Duration=1,Transition=23); width: 100%; height: 162px;"></div></font>
</td></tr>
<tr><td align="center" style='cursor:hand'><font size=2><div class="b2bbutton" id="bt0" onclick="javascript:showPage(0); clearTimeout(theTimer); theTimer=setTimeout('turnPage()',speed); checkBt();">1</div></font></td>
<td align="center" style='cursor:hand'><font size=2><div class="b2bbutton" id="bt1" onclick="javascript:showPage(1); clearTimeout(theTimer); theTimer=setTimeout('turnPage()',speed); checkBt();">2</div></font></td>
<td align="center" style='cursor:hand'><font size=2><div class="b2bbutton" id="bt2" onclick="javascript:showPage(2); clearTimeout(theTimer); theTimer=setTimeout('turnPage()',speed); checkBt();">3</div></font></td>
<td align="center" style='cursor:hand'><font size=2><div class="b2bbutton" id="bt3" onclick="javascript:showPage(3); clearTimeout(theTimer); theTimer=setTimeout('turnPage()',speed); checkBt();">4</div></font></td>
<td align="center" style='cursor:hand'><font size=2><div class="b2bbutton" id="bt4" onclick="javascript:showPage(4); clearTimeout(theTimer); theTimer=setTimeout('turnPage()',speed); checkBt();">5</div></font></td>
<td align="center" style='cursor:hand'><font size=2><div class="b2bbutton" id="bt5" onclick="javascript:showPage(5); clearTimeout(theTimer); theTimer=setTimeout('turnPage()',speed); checkBt();">6</div></font></td></tr>
</table><script language="javascript">
b2bstr=new Array();
b2bstr[0]="<div style='float: left; width=100%; overflow:hidden;'><a href="../image/1.gif" target="_blank"><img src="../iamge/1.gif" width="214px" height="145px" border="0"></a></div>"
b2bstr[1]="<div style='float: left; width=100%; overflow:hidden;'><a href="../image/2.gif" target="_blank"><img src="../iamge/2.gif" width="214px" height="145px" border="0"></a></div>"
b2bstr[2]="<div style='float: left; width=100%; overflow:hidden;'><a href="../image/3.gif" target="_blank"><img src="../iamge/3.gif" width="214px" height="145px" border="0"></a></div>"
b2bstr[3]="<div style='float: left; width=100%; overflow:hidden;'><a href="../image/4.gif" target="_blank"><img src="../iamge/4.gif" width="214px" height="145px" border="0"></a></div>"
b2bstr[4]="<div style='float: left; width=100%; overflow:hidden;'><a href="../image/5.gif" target="_blank"><img src="../iamge/5.gif" width="214px" height="145px" border="0"></a></div>"
b2bstr[5]="<div style='float: left; width=100%; overflow:hidden;'><a href="../image/6.gif" target="_blank"><img src="../iamge/6.gif" width="214px" height="145px" border="0"></a></div>"
var page=0;
var speed=3000;
function showPage(id)
{
page=id;
setTransition();
b2bContent.innerHTML=b2bstr[id];
b2bContent.filters.revealTrans.play();
}function turnPage()
{
showPage(page);
theTimer=setTimeout("turnPage()",speed);
checkBt();
page++;
if(page>=6) page=0;
}function checkBt()
{
for(var i=0;i<6;i++)
{
btObj=eval('bt'+i);
if(page==i) {btObj.style.color="#000000"; btObj.style.backgroundColor="#ff781c" }
else{btObj.style.color="#000000"; btObj.style.backgroundColor="#f7f7f7"}
}
}
function setTransition()
{
b2bContent.filters.revealTrans.Transition=Math.round(Math.random()*23);
b2bContent.filters.revealTrans.apply();
}
turnPage();
</script>
</td></tr>
</table>
</body>
<html>

解决方案 »

  1.   

    功能还没看,首先,引号的嵌套不对了吧……b2bstr[0]=" <div style='float: left; width=100%; overflow:hidden;'> <a href="../image/1.gif" target="_blank"> <img src="../iamge/1.gif" width="214px" height="145px" border="0"> </a> </div>"应该写成b2bstr[0]=" <div style='float: left; width=100%; overflow:hidden;'> <a href='../image/1.gif' target='_blank'> <img src='../iamge/1.gif' width='214px' height='145px' border='0'> </a> </div>";以此类推