亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

可以幫忙看一下嗎,點擊next 圖片不變

<!DOCTYPE html>

<html>


<head>

<meta http-equiv="content-type" content="text/html" charset="utf-8" />

<style type="text/css">

body,

div,

span {

padding: 0;

margin: 0;

}

#box {

height: 450px;

position: relative;

overflow: hidden;

width: 900px;

border: 2px solid salmon;

}

#list {

width: 4500px;

height: 450px;

position: absolute;

z-index: 1;

}

#list img {

float: left;

width: 900px;

height: 450px;

}

.arrow {

position: absolute;

width: 50px;

height: 50px;

background-color: silver;

cursor: pointer;

font-size: 30px;

text-align: center;

line-height: 50px;

top: 225px;

display: none;

z-index: 2;

color: white;

font-weight: bold;

text-decoration: none;

}

.arrow:hover{

background-color: bisque;

}

#prev {

left: 20px;

}

#next {

right: 20px;

}

#box:hover .arrow {

display: block;

}

#buttoms {

position: absolute;

bottom: 20px;

width: 100px;

height: 10px;

z-index: 2;

text-align: center;

left: 450px;

}

#buttoms span{

width: 20px;

margin-right: 10px;

float: left;

border-radius: 50%;

border: 1px solid gainsboro;

cursor: pointer;

background-color: #D3D3D3;

}

#buttoms on{

background-color: sandybrown;

}

</style>

<script type="text/javascript">

window.onload=function(){

var box=document.getElementById("box");

var list=document.getElementById("list");

var buttoms=document.getElementById("buttoms").getElementsByTagName("span");

var prev=document.getElementById("prev");

var next=document.getElementById("next");

}

// function animate(offset){

// list.style.left=parseInt(list.style.left)+offset+"px";

// }

next.onclick=function(){

list.style.left=parseInt(list.style.left)-900+"px";

}

prev.onclick=function(){

list.style.left=parseInt(list.style.left)+900+"px";

}

</script>


</head>


<body>

<div id="box">

<div id="list" style="left: -900px;">

<img src="../images/pic11.jpg" alt="3" />

<img src="../images/pic04.jpg" alt="1" />

<img src="../images/pic08.jpg" alt="2" />

<img src="../images/pic11.jpg" alt="3" />

<img src="../images/pic04.jpg" alt="1" />

</div>

<div id="buttoms">

<span index="1" class="on"></span>

<span index="2" ></span>

<span index="3" ></span>

</div>

<a href="javascript:;" class="arrow" id="prev">&lt;</a>

<a href="javascript:;" class="arrow" id="next">&gt;</a>


</div>

</body>


</html>


正在回答

2 回答

<script type="text/javascript">

window.onload=function(){

var box=document.getElementById("box");

var list=document.getElementById("list");

var buttoms=document.getElementById("buttoms").getElementsByTagName("span");

var prev=document.getElementById("prev");

var next=document.getElementById("next");

}(將這個大括號移到</script>前面)

// function animate(offset){

// list.style.left=parseInt(list.style.left)+offset+"px";

// }


next.onclick=function(){

list.style.left=parseInt(list.style.left)-900+"px";

}

prev.onclick=function(){

list.style.left=parseInt(list.style.left)+900+"px";

}

</script>


0 回復 有任何疑惑可以回復我~
#1

哈爾波兒 提問者

好的,謝謝了
2018-08-16 回復 有任何疑惑可以回復我~
#2

假裝自己是全棧

移動了大括號,next脫離了局部作用域顯示next is not defined !
2018-09-01 回復 有任何疑惑可以回復我~

window.onload=function(){}你應該去了解一下這個知識點

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

可以幫忙看一下嗎,點擊next 圖片不變

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號