0
我已經嘗試了幾個變體,但似乎無法獲取此函數來操作某些圓圈的顏色,即圖像滑塊的一部分。它需要點擊下一個箭頭。我自己添加了下一個功能,而且功能完美,但它有一個自己的按鈕。 任何幫助,將不勝感激。changecolor函數不能在JavaScript中工作
這裏是JavaScript ...
<!DOCTYPE HTML>
<html>
<head>
<title>Sidelines In The Ulvestad</title>
<link rel="stylesheet" type="text/css" href="flow.css" >
<script type="text/javascript">
VAR currentPhoto = 0; var pics = new Array();
window.onload=function() {
for (var i =0; i< 10; i++) {
pics[i] = new Image();
}
pics[0].src = "ulvestadside.png";
pics[1].src = "usl2.png";
pics[2].src = "usl3.png";
pics[3].src = "usl4.png";
pics[4].src = "usl5.png";
pics[5].src = "usl6.png";
pics[6].src = "usl7.png";
pics[7].src = "usl8.png";
pics[8].src = "usl9.png";
document.getElementById("next").onclick=nextPic;
document.getElementById("prev").onclick=prevPic;
document.getElementById("reset").onclick=reSet;
}
function changePhoto(photo) {
document.images[0].src = pics[photo].src;
}
功能nextPic(){
currentPhoto++;
changecolor();
if(currentPhoto < pics.length) {
changePhoto(currentPhoto);
}else{
reSet();
}
}
function prevPic() {
if (currentPhoto >0) {
currentPhoto--;
changePhoto(currentPhoto);
}
}
function reSet() {
document.images[0].src = pics[0].src;
currentPhoto = 0;
}
function changecolor() {
var col = document.getElementById("small")col.style.backgroundColor = "red";
}
</script>
這裏是培訓相關的HTML ...
<div class="wrapper4">
<div class ="post2f">
<img src="ulvestadside.png">
<div id ="next"> <img src ="arrow3.png"> </div>
<div id ="prev"><img src = "arrow4.png"> </div>
<button id = "reset"> reset</button>
<div id ="small"> </div>
<div id ="small1"> </div>
<div id ="small2"> </div>
<div id ="small3"> </div>
<div id ="small4"> </div>
<div id ="small5"> </div>
<div id ="small6"> </div>
<div id ="small7"> </div>
</div>
</div>
</body>
</html>
這裏是CSS ....
#small {
position:absolute;
top:390px;
left:50px;
background-color:black;
height: 10px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
width: 10px;
}
是的,它現在的作品,現在感謝那.... – user3739465