js實(shí)現(xiàn)走馬燈效果-----大屏幕滾動(dòng)抽獎(jiǎng)

<!DOCTYPE html>
<html>

在秀山土家族苗族等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、外貿(mào)營(yíng)銷網(wǎng)站建設(shè) 網(wǎng)站設(shè)計(jì)制作按需制作網(wǎng)站,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站設(shè)計(jì),營(yíng)銷型網(wǎng)站,外貿(mào)網(wǎng)站建設(shè),秀山土家族苗族網(wǎng)站建設(shè)費(fèi)用合理。

<head>
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript">
        var intervalOne = null;
        window.onload = function() {
            let arr = [
                "@------四等獎(jiǎng)---",
                "@------二等獎(jiǎng)---",
                "@------三等獎(jiǎng)---",
                "@------再來(lái)一次---",
                "@------一等獎(jiǎng)---",
                "@------三等獎(jiǎng)---",
                "@------四等獎(jiǎng)---",
                "@------四等獎(jiǎng)---",
                "@------再來(lái)一次---",
                "@------四等獎(jiǎng)---"
            ];
            show(arr);
            intervalOne = setInterval(function() {
                scroll();
            }, 10);
        }

        function show(arr) {
            for(item in arr) {
                let inner_div = document.createElement("div");
                inner_div.id = "item" + item;
                inner_div.style.height = "40px";
                inner_div.style.backgroundColor = item % 2 == 0 ? "#B9E3FB" : "#FFFFCC";
                inner_div.innerText = arr[item];
                inner_div.onclick = function() {
                    document.getElementById("show_data").innerText = "中獎(jiǎng)情況:" + inner_div.innerText;
                }
                let out_div = document.getElementById("out_div");
                out_div.appendChild(inner_div);
            }
        }

        function scroll() {
            let scrollTop = document.getElementById("out_div").scrollTop;
            document.getElementById("out_div").scrollTop = scrollTop + 10;
            if(39 <= scrollTop) {
                let one_inner_div = document.getElementById("out_div").firstChild;
                document.getElementById("out_div").removeChild(one_inner_div);
                document.getElementById("out_div").appendChild(one_inner_div);
            }
        }

        function mouseover1() {
            clearInterval(intervalOne);
        }

        function onmouseleave1() {
            intervalOne = setInterval(function() {
                scroll();
            }, 10);
        }

        function click1(flag) {
            debugger
            if(flag) {
                clearInterval(intervalOne);
                let one_inner_div = document.getElementById("out_div").firstChild;
                document.getElementById("show_data").innerText = "中獎(jiǎng)情況:" + one_inner_div.innerText;
            } else {
                intervalOne = setInterval(function() {
                    scroll();
                }, 10);

            }
        }
    </script>
</head>

<body>
    <div id="out_div"  onmouseover="mouseover1()" onmouseleave="onmouseleave1()">
    </div>
    <input id="stop" type="button" value="***停***" onclick="click1(true)">
    </input>
    <input id="stop" type="button" value="***繼續(xù)***" onclick="click1(false)">
    </input>
    <div id="show_data">

    </div>
</body>

</html>

分享文章:js實(shí)現(xiàn)走馬燈效果-----大屏幕滾動(dòng)抽獎(jiǎng)
文章地址:http://muchs.cn/article32/jpejpc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、網(wǎng)站排名網(wǎng)站營(yíng)銷、電子商務(wù)、商城網(wǎng)站網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

營(yíng)銷型網(wǎng)站建設(shè)