304346845
2016-03-29 15:15:35
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無(wú)標(biāo)題文檔</title><style>#box{width:400px;?? ?height:500px;?? ?border:5px solid #333;?? ?background-color:#CCC;?? ?position:relative;?? ?margin:10px auto;}#prev{width:50px;?? ?height:400px;?? ?opacity:0.8;?? ?position:absolute;?? ?left:0px;?? ?top:50px;?? ?background:#ccc;?? ?border:5px solid #000;?? ?text-align:center;?? ?text-decoration:none;?? ?font-size:50px;?? ?font-weight:bold;?? ?line-height:400px;?? ?border-left:none;}#next{width:50px;?? ?height:400px;?? ?opacity:0.8;?? ?position:absolute;?? ?right:0px;?? ?top:50px;?? ?background:#ccc;?? ?border:5px solid #000;?? ?text-align:center;?? ?text-decoration:none;?? ?font-size:50px;?? ?font-weight:bold;?? ?line-height:400px;?? ?border-right:none;}#img1{width:400px;?? ?height:500px;}#con{?? ?position: absolute;?? ?width: 400px;?? ?height:30px;?? ?left: 0px;?? ?bottom:0px;?? ?text-align:center;?? ?line-height:30px;?? ?background:black;?? ?margin:0;?? ?color:#FFF;?? ?opacity:0.5;}#wocao{?? ?position: absolute;?? ?width: 400px;?? ?height: 30px;?? ?left: 0px;?? ?top: 0px;?? ?text-align:center;?? ?line-height:30px;?? ?background:black;?? ?margin:0;?? ?color:#FFF;?? ?opacity:0.5;}#box2{text-align:center;?? ?margin-top:30px;}</style><script>window.onload = function (){?? ?var oBox2 = document.getElementById('box2');?? ?var oBox = document.getElementById('box');?? ?var oBtn1 = document.getElementById('btn1');?? ?var oBtn2 = document.getElementById('btn2');?? ?var oPrev = document.getElementById('prev');?? ?var oNext = document.getElementById('next');?? ?var oImg = document.getElementById('img1');?? ?var oCon = document.getElementById('con');?? ?var oWo = document.getElementById('wocao');?? ?var arrUrl = ['http://www.9669.com/uploadfile/2015/0824/20150824085615657.png','http://img3.pcgames.com.cn/pcgames/1006/03/1920087_2009062301061245690095_7716_thumb.jpg','http://pic.baike.soso.com/p/20120914/20120914171422-1627901078.jpg','http://img.265g.com/userup/1104/201104291443348880.jpg'];?? ?var arrText = ['草稚京','八神庵','盧卡爾','大蛇'];?? ?var num = 0;?? ?function fnTab(){?? ?? oWo.innerHTML = num+1 +' / '+ arrText.length; ??? ?? oCon.innerHTML = arrText[num]; ?? ??? ??? ??? ?? oImg.src = arrUrl[num];?? ?? }?? ?? fnTab();?? ? oPrev.onclick = function (){?? ??? ?num --;?? ??? ?fnTab();?? ?};?? ?? oNext.onclick = function (){?? ??? ?num ++;?? ??? ?fnTab();?? ?};?? ??? ??? ?};</script> ?</head><body><div id="box2">?? ?<input id="btn1" type="button" value="循環(huán)點(diǎn)擊">?? ?<input id="btn2" type="button" value="順序點(diǎn)擊"></div><div id="box">?? ?<a href="" id="prev"/><</a>?? ?<a href="" id="next"/>></a>?? ?<img id="img1"/>?? ?<p id="con">圖片正在加載中......</p>?? ?<p id="wocao">數(shù)量正在計(jì)算中......</p></div></body></html>
3 回答

hxh_kylin
TA貢獻(xiàn)33條經(jīng)驗(yàn) 獲得超10個(gè)贊
? ? ?oPrev.onclick = function (){
?? ??? ?num --;
?? ??? ?fnTab();
?? ?};
?? ?? oNext.onclick = function (){
?? ??? ?num ++;
?? ??? ?fnTab();
?? ?};
這兩處寫(xiě)錯(cuò)了,應(yīng)該是
oBtn1.onclick = function (){
? ? ? ? num --;
? ? ? ? fnTab();
? ? };
? ? ? oBtn2.onclick = function (){
? ? ? ? num ++;
? ? ? ? fnTab();
? ? };
添加回答
舉報(bào)
0/150
提交
取消