2018-06-24 简单轮播图

2018-06-24  本文已影响0人  孤独又可爱的虎虎

老师布置3个作业
1、轮播
2、163登陆页
3、ecnu首页通知栏

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        div {
            text-align:center;     
            vertical-align:middle;
        }
    </style>
    <script type="text/javascript" src="/plugin/jquery-easyui-1.4.3/jquery.min.js"></script>
    <script type="text/javascript">
    function div_tab(tabName){
        var tabLinkArr=document.getElementsByName("tablink");
        var tabPicArr=document.getElementById("tabpic").getElementsByTagName("div");
        for(var i=0;i<tabLinkArr.length;i++){
            if(i==tabName){
                tabLinkArr[i].style.color="#ff0000";
                tabPicArr[i].style.display="block";
            } else{
                tabLinkArr[i].style.color="#0000ff";
                tabPicArr[i].style.display="none";
            }
        }
    }
    var i=0;
    function auto_tab_div(){
    if(i>3){
        i=0;
    }
    div_tab(i);
        i++;
    }
    setInterval("auto_tab_div()",2000);
</script>
</head>
<body style="background-color: gray">
    <div id="carousel"  float:left; width:800px;">
        <div id="tabpic" >
            <div style="display:block;"><img src="images/1.jpg" width="800px"/></div>
            <div style="display:none;"><img src="images/2.jpg" width="800px" /></div>
            <div style="display:none;"><img src="images/3.jpg" width="800px" /></div>
            <div style="display:none;"><img src="images/4.jpg" width="800px" /></div>
        </div>
        <div >
            <a href="javascript:void(0)" name="tablink" onclick="div_tab(0)" style="color:#ff0000;">1</a>
            <a href="javascript:void(0)" name="tablink" onclick="div_tab(1)" style="color:#0000ff;">2</a>
            <a href="javascript:void(0)" name="tablink" onclick="div_tab(2)" style="color:#0000ff;">3</a>
            <a href="javascript:void(0)" name="tablink" onclick="div_tab(3)" style="color:#0000ff;">4</a>
        </div>
    </div>
</body>


</html>


今晚回去还要改一下作业,这里参考一下大大的代码

https://www.cnblogs.com/LIUYANZUO/p/5679753.html

上一篇下一篇

猜你喜欢

热点阅读