<SCRIPT type="text/javascript">
/*
*此全部代碼存為html可直接使用,或jsp中引用
*/
var widths=500; /*顯示高度*/
var heights=300; /*顯示寬度*/
var counts=6; /*照片數(shù)量*/
/**
*如果你是不固定的圖片,可以使用數(shù)組定義,
讓然下面一些代碼也要有相應(yīng)的改動,不多介紹,如果你不會可以問我。
var img=Array();//圖片數(shù)組
var url=Array();//url數(shù)組
for(i=1;i<=counts;i++)
{
img[i]=new Image();
img[i].src=lst[i-1].imgurl;
url[i]=new Image();
url[i].src=lst[i-1].link;
}
**/
//一個img對應(yīng)一個連接url,這在下面取得時候是對應(yīng)的,如果你想改動,下面也要對應(yīng)改動
//img.src是指圖片路徑,url是點擊圖片是跳轉(zhuǎn)的頁面連接。
img1=new Image ();img1.src='http://hiphotos.baidu.com/slzs_zyt/mpic/item/5165e3ce320ed70893457efc.jpg';
img2=new Image ();img2.src='http://hiphotos.baidu.com/slzs_zyt/mpic/item/7e88b0ef1baac8fecf1b3e73.jpg';
img3=new Image ();img3.src='http://hiphotos.baidu.com/slzs_zyt/mpic/item/acb3e65cec61e560faf2c073.jpg';
img4=new Image ();img4.src='http://hiphotos.baidu.com/slzs_zyt/mpic/item/07b627089c62a913e824887c.jpg';
img5=new Image ();img5.src='http://hiphotos.baidu.com/slzs_zyt/mpic/item/3812a7d6be6a500807088bb3.jpg';
img6=new Image ();img6.src='http://hiphotos.baidu.com/slzs_zyt/mpic/item/48999aa1df1d7682471064ca.jpg';
//img.src是指圖片路徑,url是點擊圖片是跳轉(zhuǎn)的頁面連接。
url1=new Image ();url1.src='http://hi.baidu.com/slzs_zyt/album/%BA%C3%C4%D1%B9%FD';
url2=new Image ();url2.src='http://hi.baidu.com/slzs_zyt/album/%BA%C3%C4%D1%B9%FD';
url3=new Image ();url3.src='http://hi.baidu.com/slzs_zyt/album/%BA%C3%C4%D1%B9%FD';
url4=new Image ();url4.src='http://hi.baidu.com/slzs_zyt/album/%BA%C3%C4%D1%B9%FD';
url5=new Image ();url5.src='http://hi.baidu.com/slzs_zyt/album/%BA%C3%C4%D1%B9%FD';
url6=new Image ();url6.src='http://hi.baidu.com/slzs_zyt/album/%BA%C3%C4%D1%B9%FD';
/* 以下基本不需要改動,不過當(dāng)你涉及到改動變量和參數(shù)的時候 ,當(dāng)然也有改動的必要*/
var nn = 1;
var key = 0;
function change_img() {
if (key == 0) {
key = 1;
} else {
if (document.all) {
document.getElementById("pic").filters[0].Apply();
//圖片切換改變中的時間,越小切換越快
document.getElementById("pic").filters[0].Play(duration = 2);
}
}
eval("document.getElementById(\"pic\").src=img" + nn + ".src");
eval("document.getElementById(\"url\").href=url" + nn + ".src");
for (var i = 1; i <= counts; i++) {
document.getElementById("xxjdjj" + i).className = "axx";
}
document.getElementById("xxjdjj" + nn).className = "bxx";
nn++;
if (nn > counts) {
nn = 1;
}
//圖片切換的時間間隔
tt = setTimeout("change_img()", 4000);
}
function changeimg(n) {
nn = n;
window.clearInterval(tt);
change_img();
}
document.write("<style>");
document.write(".axx{padding:0px 7px 3px;*padding:1px 7px;border-left:#cccccc 1px solid;}");
document.write("a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#666;}");
document.write("a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#999;}");
document.write(".bxx{padding:0px 7px 3px;*padding:1px 7px;border-left:#cccccc 1px solid;}");
document.write("a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}");
document.write("a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}");
document.write("</style>");
document.write("<div style=\"width:" + widths + "px;height:" + heights + "px;overflow:hidden;text-overflow:clip;\">");
document.write("<div><a id=\"url\"><img id=\"pic\" style=\"border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)\" width=" + widths + " height=" + heights + " /></a></div>");
document.write("<div style=\"filter:alpha(style=1,opacity=10,finishOpacity=80);-moz-opacity:0.8; opacity:0.8;background: #888888;width:100%-2px;text-align:right;top:-12px;position:relative;margin:1px;height:12px;padding:0px;margin:0px;border:0px;\">");
for (var i = 1; i < counts + 1; i++) {
document.write("<a href=\"javascript:changeimg(" + i + ");\" id=\"xxjdjj" + i + "\" class=\"axx\" target=\"_self\">" + i + "</a>");
}
document.write("</div></div>");
change_img();
</SCRIPT>
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點擊舉報。