飞龙博客

feilong.org

在visual studio asp net插入图片切换效果代码

feilong.org 修订于2008-07-04 04:02:50 435 次浏览

用 visual studio 开发.net网站网页的时候,如果想插入图片切换的效果,代码如下:
<script language="javascript">
var delay=4000 //set delay in miliseconds
var curindex=0
var randomimages=new Array()
randomimages[0]="jiaju99.com/feilong0.jpg"
randomimages[1]="jiaju99.com/feilong1.jpg"
randomimages[2]="jiaju99.com/feilong2.jpg"
randomimages[3]="jiaju99.com/feilong3.jpg"
randomimages[4]="jiaju99.com/feilong4.jpg"
randomimages[5]="jiaju99.com/feilong5.jpg"
randomimages[6]="jiaju99.com/feilong6.jpg"
randomimages[7]="jiaju99.com/feilong7.jpg"
var preload=new Array()
for (n=0;n<randomimages.length;n++)
{
preload[n]=new Image()
preload[n].src=randomimages[n]
}
document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'" mce_src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')
function rotateimage()
{
if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
curindex=curindex==0? 1 : curindex-1
}
else
curindex=tempindex
document.images.defaultimage.src=randomimages[curindex]
}
setInterval("rotateimage()",delay)
</script>

博主:飞龙.org
链接:http://feilong.org/asp-net-tupian-qiehuan
网络资料,朋友共享,http://feilong.org 可加入收藏夹

更新网址:https://feilong.org/asp-net-tupian-qiehuan
最初发布:20080704 04:02:50 feilong.org 于广州

加入收藏夹,查看更方便。

所在分类: 网站开发

新作:

旧文:

AI音乐 blog money bui 教程 echarts 教程 eclipse 教程 html css 教程 IT趋势 js 教程 json 教程 mysql 教程 nodejs npm 教程 onblog SQLite 教程 tutorials vscode 教程 wap网站 winpe启动盘 wordpress 主机推荐 人工智能 前端开发 博客 名企名网 域名注册 常用软件 建站程序 操作系统 教程 数码 无线上网 日记 电子商务 电脑笔记本 网站 网站优化 网站开发 网站推广 网站策划 网络 虚拟现实 默认