希特勒 犹太血统:请问让图片在HTML中不动但可换另图片的代码
来源:百度文库 编辑:神马品牌网 时间:2024/04/29 11:51:24
悬赏30 如果好的 再+
图来回变 没必要 整个控制器 不是很高级的
图来回变 我只在网页做的炫点 还就是鼠标经过时 图要停下
脚本说明:
把如下代码加入<body>区域中
<style type="text/css">
<!--
td {font-family: Verdana, Arial, sans-serif, Helvetica; font-size: 12px; color: #F0F0F0;}
a {font-family: Verdana, Arial, sans-serif, Helvetica; font-size: 12px; color: #F0F0F0; text-decoration: none}
#btnStyle {font-family: Verdana, Arial, sans-serif, Helvetica; font-size: 12px; background-color: #C0C020; border-top: 0px solid; border-bottom: 0px solid; border-left: 0px solid; border-right: 0px solid;}
//--></style>
<script language="JavaScript" type="text/JavaScript"><!--
var img = new Array(10); //array to hold the images
var start = null; //start pointer
var counter = 1; //counts the image sequences
var delayTime = null; //user defined
if(document.images) //pre-load all the images
{
/* change the looping condition if you want
to add or remove images. Do not load too
many images, it will slow down the program's
loading time [e.g. 30 or above images] */
for(i = 1; i <= 10; i++)
{
img[i] = new Image();
img[i].src = "20030519/pic" + i + ".jpg";
}
}
//function for getting the user defined delay time
function getDelayTime(dlTime)
{
var temp = parseInt(dlTime);
if(temp != NaN)
delayTime = temp * 1000;
else
delayTime = 4000;
}
//function for changing the images
function anim()
{
counter++;
document.images[0].src = img[counter].src;
if(counter == 10)
counter = 0; //sets the counter value to 0
}
//function for starting the slide show
function slide()
{
getDelayTime(document.form1.delay.value);
with(document.form1)
{
start = setInterval("anim()", delayTime);
stShow.disabled = true;
spShow.disabled = false;
}
}
//function to stop the slide show
function stopSlide()
{
clearInterval(start);
document.form1.stShow.disabled = false;
document.form1.spShow.disabled = true;
}
//--></script>
<table align=center border=0 cellspacing=0 cellpadding=4 bgcolor=#000000>
<tr><td valign=top align=center>
<img src="20030519/pic1.jpg" border=0 width=400 height=300><br>
<form name="form1">
请输入图片显示间隔时间:
<input type=text size=2 value="4" name=delay><br>
<input type=button value="Start Show" name=stShow onClick="slide();" id=btnStyle>
<input type=button value="Stop Show" name=spShow onClick="stopSlide();" id=btnStyle DISABLED><br>
</form>
</td></tr></table>