还有,如果我不想用<body onload=xxx>来激活一个函数,该如何采用其他方法?我在函数下加上document.onload=xxx()不起作用.

解决方案 »

  1.   

    http://www.51windows.net/myjs/?u=/hw/asp/jsview.asp?id=132
    图片可能已经看不到了,但实现了你要的功能.
    感谢 51windows 的代码收藏站.
      

  2.   

    <body onload="NextImg()">
    <script>
    var ImgUrl=new Array();
    var ImgLink=new Array();
    var iCount=0;
    ImgUrl[1]="参加补给训练的海军167驱逐舰.jpg";
    ImgLink[1]="#";
    ImgUrl[2]="中国的航母.jpg";
    ImgLink[2]="#";
    ImgUrl[3]="中国自行火炮系列.jpg";
    ImgLink[3]="#";
    ImgUrl[4]="中国人民警察警种分辨99式警服的警监警衔.jpg";
    ImgLink[4]="#";
    ImgUrl[5]="中国人民警察警种分辨99式警服的专业胸徽.jpg";
    ImgLink[5]="#";var ImgPre=new Array();
    var kCount=0;
    for(iIndex=1;iIndex<=5;iIndex++)
    {
    if((ImgUrl[iIndex]!="")&&(ImgLink[iIndex]!=""))
    {
    kCount++;
    }
    else
    {
    break;
    }
    }
    function PlayTran()
    {
    if(document.all)
    ImgInit.filters.revealTrans.play();
    }var iKey=0;
    function NextImg()
    {
    if(iCount<kCount)iCount++;
    else iCount=1;

    if(iKey==0)
    {
    iKey=1;
    }
    else if(document.all)
    {
    ImgInit.filters.revealTrans.Transition=6;
    ImgInit.filters.revealTrans.apply();
                    PlayTran(); }
    document.images.ImgInit.src=ImgUrl[iCount];
    TheTimer=setTimeout("NextImg()",3000);
    }function GoUrl()
    {
    JumpUrl=ImgLink[iCount];
    JumpTarget='_blank';
    if(JumpUrl!='')
    {
    if(JumpTarget!='')
    window.open(JumpUrl,JumpTarget);
    else
    location.href=JumpUrl;
    }
    }
    </script>
    <a href="javascript:GoUrl()"><img style="border-left-color:black;filter:revealTrans(duration=2,transition=20);border-bottom-color:black;color:#000000;border-top-color:black;border-right-color:black;" height=400 width=500 src="歼10.jpg" border=1 name=ImgInit></a>
      

  3.   

    http://www.iecn.net/forum/showthread.php?threadid=714