导航

随机显示图片js脚本

October 16, 2019 • Read: 53 • 资源分享

<html>
<head>
    <meta charset="utf-8">
    <title>我爱你❤️据说每个人扫出来的不一样幺</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <style type="text/css">
    body{background-color: #fff;}
    div{
        width: 100%;
        float: left;
        position: relative;
        min-height: 1px;
        box-sizing: border-box;
        display: block;
    }
    img{
        display: block;
        margin-right: auto; 
        margin-left: auto;
        max-width: 100%;
        height: auto;
        padding-top:132px;
    }
    </style>
</head>
<script language="JavaScript">
    window.onload = function() {
        o.imgRandom();
    }
    var o = {
        aImg: [
            'a01', 'a02', 'a03', 'a04', 'a05', 'a06', 'a07', 'a08', 'a09', 'a10',
            'a11', 'a12', 'a13', 'a14', 'a15', 'a16', 'a17', 'a18', 'a19', 'a20',
            'a21', 'a22', 'a23', 'a24', 'a25', 'a26', 'a27', 'a28', 'a29', 'a30',
            'a31', 'a32', 'a33', 'a34', 'a35', 'a36', 'a37', 'a38', 'a39', 'a40',
            'a41', 'a42', 'a43', 'a44', 'a45', 'a46', 'a47', 'a48', 'a49', 'a50',
            'a51', 'a52', 'a53', 'a54', 'a55', 'a56', 'a57', 'a58', 'a59', 'a60',
            'a61', 'a62', 'a63', 'a64', 'a65', 'a66', 'a67', 'a68', 'a69', 'a70',
            'a71', 'a72', 'a73', 'a74', 'a75', 'a76', 'a77', 'a78', 'a79', 'a80',
            'a81', 'a82', 'a83', 'a84', 'a85', 'a86', 'a87', 'a88', 'a89', 'a90',
            'a91', 'a92', 'a93',
        ],
        imgRandom: function() {
            var img = document.getElementsByTagName("img")[0];
            var b = Math.random() * 100;
            b = Math.floor(b) % (this.aImg.length);
            img.src = this.aImg[b] + ".png";
        }
    };
</script>

<body onselectstart="return false">
    <div>
        <img name="randimg" src="img/a1.png">
    </div>
</body>
</html>
Last Modified: November 16, 2019
Archives Tip
QR Code for this page
Tipping QR Code