把以下代码加入<head>...</head>之间。
<script LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -
var imgsname = new Array()
imgsname[0]="../images/DJ.gif"
imgsname[1]="../images/DX.gif"
imgsname[2]="../images/DM.gif"
imgsname[3]="../images/hsi.gif"
imgsname[4]="../images/NIK.gif"
// the links for each image
// Configure the distance to the left and top margin of the window (pixels)
var imgstop=20
var imgsleft=20
// Configure the speed of the transition effect. less means faster
var pause=1
// Configure the standstill-time of the images (seconds)
var standstill=3000
// Do not change the variables below this line
var imgpreload=new Array()
for (i=0;i<=imgsname.length-1;i++) {
imgpreload[i]=new Image()
imgpreload[i].src=imgsname[i]
}
var coverimage = new Array()
/*coverimage[0]="transheart0.gif"
coverimage[1]="transheart1.gif"
coverimage[2]="transheart2.gif"
coverimage[3]="transheart3.gif"*/
coverimage[0]="images/HKD.gif"
var covimgpreload=new Array()
for (i=0;i<=coverimage.length-1;i++) {
covimgpreload[i]=new Image()
covimgpreload[i].src=coverimage[i]
}
var i_imgs=0
var i_loop=0
var thisurl=0
var timer
stamdstill=standstill*1000
function init() {
if (document.all
document.layers) {
document.all.imgs.style.posTop=imgstop
document.all.imgs.style.posLeft=imgsleft
document.all.cover.style.posTop=imgstop
document.all.cover.style.posLeft=imgsleft
enlargehearts()
}
}
function enlargehearts() {
if (i_loop<=coverimage.length-1) {
if (document.all) {
imgcover.src=coverimage[i_loop]
}
if (document.layers) {
document.cover.document.imgcover.src=coverimage[i_loop]
}
i_loop++
timer= setTimeout("enlargehearts()",pause)
}
else {
clearTimeout(timer)
i_loop--
timer= setTimeout("shrinkhearts()",standstill)
}
}
function shrinkhearts() {
if (i_loop>=0) {
if (document.all) {
imgcover.src=coverimage[i_loop]
}
if (document.layers) {
document.cover.document.imgcover.src=coverimage[i_loop]
}
i_loop--
timer= setTimeout("shrinkhearts()",pause)
}
else {
clearTimeout(timer)
i_loop=0
i_imgs++
if (i_imgs>=imgsname.length) {i_imgs=0}
if (document.all) {
imgsback.src=imgsname[i_imgs]
}
if (document.layers) {
document.imgs.document.imgsback.src=imgsname[i_imgs]
}
timer= setTimeout("enlargehearts()",(4*pause))
}
}
// - End of JavaScript - -->
</script>
在<body>加入下面代码:<body onLoad="init();">
在<body>...</body>任何位置加入下面代码:
<div ID="imgs" class="imgsstyle">
<img height="400" src="../images/DJ.gif" width="540" border="0" name="imgsback">
</div>
<div ID="cover" class="imgsstyle">
<img height="1" src="../images/HKD.gif" width="1" border="0" name="imgcover">
</div>
……