zoukankan      html  css  js  c++  java
  • js随机点名器(简单)


     

    <!DOCTYPE html>
    
    <html lang="en">
    
    <head>
    
        <meta charset="UTF-8">
    
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
    
        <title>Document</title>
    
        <style>
    
            *{
    
                margin: 0;
    
                padding:0;
    
            }
    
            ul {
    
                list-style: none;
    
            }
    
            .content {
    
                /*  400px; */
    
                margin-left: 200px;
    
                
    
            }
    
            .content ul > li {
    
                padding: 23px 0;
    
                border-bottom: 1px solid gray;
    
            }
    
            .content ul li:last-child {
    
                border: 0;
    
            }
    
            .content li a {
    
                text-decoration: none;
    
                margin-left: 35px;
    
                color: #666;
    
                font-weight: bold;
    
            }
    
            .content li a:hover {
    
                color: red;
    
            }
    
        .box {
    
             600px;
    
            height: 200px;
    
            margin: 20px auto;
    
            position: relative;
    
            border: 1px solid gray;
    
        }
    
        .pic {
    
            float: left;
    
             200px;
    
            height: 200px;
    
        }
    
        .pic img {
    
             200px;
    
            height: 200px;
    
        }
    
        .tit {
    
            position: absolute;
    
        top: -12px;
    
        right: 14px;
    
         100px;
    
        height: 30px;
    
        line-height: 30px;
    
        text-align: center;
    
        color: #fff;
    
        background-color: green;
    
        }
    
        .tit_after {
    
            border-top: 10px solid transparent;
    
        border-bottom: -1px solid transparent;
    
        border-left: 10px solid green;
    
        position: absolute;
    
        top: -11px;
    
        right: 4px;
    
        z-index: 0;
    
        }
    
      
    
        </style>
    
    </head>
    
    <body>
    
        <div class="box">
    
            <div class="pic">
    
                <img src="images/01.jpg" alt="" id="img">
    
            </div>
    
            <div class="content">
    
                    <ul>
    
                            <li class="li"><a href="###">健身后吃什么补充优质蛋白质?这4</a></li>
    
                            <li class="li"><a href="###">什么是蛋白粉?蛋白粉哪个牌子好?</a></li>
    
                            <li class="li"><a href="###">南方春节食物的寓意</a></li>
    
                        </ul>
    
            </div>
    
            <div class="tit">
    
                <span>食品安全</span>
    
            </div>
    
            <div class="tit_after"></div>
    
        </div>
    
    
    
        <script>
    
            var lis = document.getElementsByClassName("li");
    
            var img = document.getElementById("img");
    
            for(var i=0;i<lis.length;i++) {
    
                lis[i].index = i;
    
                lis[i].onmouseover = function() {
    
                    img.src = "images/0"+(this.index+1)+".jpg";
    
                }
    
            }
    
            </script>
    
    </body>
    
    </html>
  • 相关阅读:
    UVA 11384 Help is needed for Dexter(问题转化 递归)
    UVA 11991 Easy Problem from Rujia Liu?(vector map)
    poj 2656 Unhappy Jinjin
    解析磁盘0号扇区数据
    树的非递归遍历
    iOS项目开发实战——使用同步请求获取网页源码
    单点登录cas常见问题(四)
    bzoj2115【WC2001】Xor
    最小化JavaScript代码
    quick-cocos2d-x教程9:实例之加上背景图片
  • 原文地址:https://www.cnblogs.com/wjlbk/p/12633454.html
Copyright © 2011-2022 走看看