var imgPre=new Array();
var j=0;
for (i=1;i<=3;i++) {
if( (imgUrl[i]!="") && (imgLink[i]!="") ) {
j++;
} else {
break;
}
}
function playTran(){
if (document.all)
imgInit.filters.revealTrans.play();
}
function nextAd(){
if(adNum<j)adNum++ ;
else adNum=1;
if (document.all){
imgInit.filters.revealTrans.Transition=12;
imgInit.filters.revealTrans.apply();
}
document.images.imgInit.src=imgUrl[adNum];
playTran();
theTimer=setTimeout("nextAd()", 8000);
}
function goUrl(){
jumpUrl=imgLink[adNum];
jumpTarget='_blank';
if (jumpUrl != ''){
if (jumpTarget != '')
window.open(jumpUrl,jumpTarget);
else
location.href=jumpUrl;
}
}
</script>
<a href="javascript:goUrl()"><div align="center"><img style="FILTER: revealTrans(duration=2,transition=20);border-color:#000000;color:#000000;margin-bottom:0px" src="javascript:nextAd()" height=232 width=221 border=0 name=imgInit></div></a>
4.圖片自動轉(zhuǎn)換
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var interval = 2.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;
var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("image_list[image_index++] = new imageItem("image_list[image_index++] = new imageItem("image_list[image_index++] = new imageItem("var number_of_image = image_list.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
setTimeout(recur_call, interval);
}
// End -->
</script>
第二步:把<body>中加入如下代碼:
<img name="rImage" src="
第三步:把<body>中內(nèi)容改為:
<body bgcolor="#fef4d9" O