首页 > 代码库 > 十七天

十七天

图片轮播

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <title>网页标题</title>
    <meta name="keywords" content="关键字列表" />
    <meta name="description" content="网页描述" />
    <link rel="stylesheet" type="text/css" href="" />
    <style type="text/css"></style>
    <script type="text/javascript">
        window.onload=init;
        function init(){
        //定时器:每隔一秒调start()函数一次
            window.setInterval(start2(),1000);
        }
        var i=1;
        function start2(){
        //获取到图片的id经行操作
            var imgObj = document.getElementById(img);
            //把图片的路径修改
            imgObj.src=../images/images/p_00+i+.jpg;
            i++;
            //判断i大于6时进行修改i=0
            if(i>6){
                i=0;
            }
        } 
    </script>
</head>
<body>
    <img id=‘img‘ src=‘../images/images/p_000.jpg‘/>
</body>
</html>

 

十七天