function?openNew(){
//創(chuàng)建新的節(jié)點(diǎn)
var?oMask?=?document.createElement("div");
oMask.id?=?"mask";
document.body.appendChild(oMask);
/*
*創(chuàng)建關(guān)閉按鈕的新節(jié)點(diǎn)
*/
var?oImg?=?document.createElement("div");
oImg.id?=?"img";
oImg.innerHTML?=?"<div?class='imgCon'><div?id='close'>點(diǎn)擊關(guān)閉</div></div>";
document.body.appendChild(oImg);
//點(diǎn)擊關(guān)閉按鈕
var?oClose?=?document.getElementById("close");
oClose.onclick?=?oMask.onclick?=?function(){
document.body.removeChild(oMask);
document.body.removeChild(oImg);
document.body.removeChild(oLimg);
document.body.removeChild(oLeft);
document.body.removeChild(oRight);
}
/*
*創(chuàng)建遮罩層圖片的新節(jié)點(diǎn)
*/
var?oLimg?=?document.createElement("div");
oLimg.id?=?"img";
oLimg.innerHTML?=?"<div?id='number'><ul><li></li><li></li><li></li></ul></div>";
document.body.appendChild(oLimg);
/*
*?創(chuàng)建左邊切圖的新節(jié)點(diǎn)
*/
var?oLeft?=?document.createElement("div");
oLeft.id?=?"img";
oLeft.innerHTML?=?"<div?id='left'><</div>";
document.body.appendChild(oLeft);
/*
*?創(chuàng)建右邊切圖的新節(jié)點(diǎn)
*/
var?oRight?=?document.createElement("div");
oRight.id?=?"img";
oRight.innerHTML?=?"<div?id='right'>></div>";
document.body.appendChild(oRight);
var?abc?=?1;
var?lis?=?document.getElementById("number").getElementsByTagName("li");
var?ms?=?document.getElementById("img");
var?addleft?=?document.getElementById("left");
var?addright?=?document.getElementById("right");
var?len?=?lis.length;
//手動(dòng)切換圖片
addleft.onclick=function(){
abc=abc-1;
if(abc<1){
abc=len;
}
ms.style.background="url('../images"+abc+".jpg')";
for?(var?i?=?0;?i?<?len;?i++)?{
var?x=abc-1;
lis[i].style.background="blue";
if?(x==i)?{
lis[i].style.background="yellow";
}
}
}
addright.onclick=function(){
abc=abc+1;
if(abc>len){
abc=1;
}
ms.style.background="url('../images"+abc+".jpg')";
for?(var?i?=?0;?i?<?len;?i++)?{
var?x=abc-1;
lis[i].style.background="blue";
if?(x==i)?{
lis[i].style.background="yellow";
}
}
}
function?show(){
lun?=?setInterval(function(){
abc?=?abc?+?1;
if?(abc?>?len)?{
abc?=?1;
}
ms.style.background?=?"url('../images"+abc+".jpg')";
var?x?=?abc?-?1;
for?(var?i?=?0;?i?<len;?i++)?{
lis[i].style.background?=?"url('../images"+abc+".jpg')";
if(x?==?i){
lis[i].style.background?=?"url('../images"+abc+".jpg')";
}
},2000);
}
show();
}