<BODY>
<IMG id="i0" SRC="http://www.phpe.net/images/partner/phpclasses.gif"  BORDER="0" ALT="">
<IMG id="i1" SRC="http://phpe.net/images/special/5_b.gif"  BORDER="0" ALT="">
</BODY>
</HTML>
<script language="javascript" type="text/javascript">

var flag = '';
function window.onload()
{ window.setInterval("sh()", 800); } function sh()
{
var i0 = document.getElementById("i0");
var i1 = document.getElementById("i1");
i0.style.display = flag;
i1.style.display = flag;
flag = flag=='none'?'':'none';
}</script>

解决方案 »

  1.   

    如果是不用去操作单张图片下面的亦可,减少了JS
    <BODY>
    <div id="con">
    <IMG id="i0" SRC="http://www.phpe.net/images/partner/phpclasses.gif"  BORDER="0" ALT="">
    <IMG id="i1" SRC="http://phpe.net/images/special/5_b.gif"  BORDER="0" ALT="">
    </div>
    </BODY>
    </HTML>
    <script language="javascript" type="text/javascript">

    var flag = '';
    function window.onload()
    { window.setInterval("sh()", 800); } function sh()
    {
    var i0 = document.getElementById("con");
    i0.style.display = flag;
    flag = flag=='none'?'':'none';
    }
    </script>
      

  2.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 1</title>
    </head><body>
    <script>
    var img1,img2,i=0;
    img1=new Image();
    img1.src="http://zi.csdn.net/comm_button.gif";
    img2=new Image();
    img2.src="http://zi.csdn.net/csdn-ppbutton_120.gif";
    function changeimg(){
    myimg.src=eval("img"+(i+1)).src;
    i=1-i;
    t=setTimeout("changeimg()",500);
    }
    window.onload=function(){changeimg()}
    </script>
    <img id=myimg></body></html>