您好,登錄后才能下訂單哦!
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
var intervalOne = null;
window.onload = function() {
let arr = [
"@------四等獎---",
"@------二等獎---",
"@------三等獎---",
"@------再來一次---",
"@------一等獎---",
"@------三等獎---",
"@------四等獎---",
"@------四等獎---",
"@------再來一次---",
"@------四等獎---"
];
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 = "中獎情況:" + 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 = "中獎情況:" + 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="***繼續***" onclick="click1(false)">
</input>
<div id="show_data">
</div>
</body>
</html>
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。