加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

打造完美的图片播放器

(2007-04-16 15:41:04)
分类: 时尚潮流类爱美心皆有之
代码如下:

<html><head><title>幻灯片播放</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var interval = 6; // delay between rotating images (in seconds)
interval *= 1000;
var flagtime=0;
var image_index = -1;
image_list = new Array();
note_list = new noteArray(10);
var number_of_image = image_list.length;
var timesnum=0;
//下面为图片的位置
image_list[0] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b5-a.jpg");
image_list[1] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b1-a.jpg");
image_list[2] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b2-a.jpg");
image_list[3] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b3-a.jpg");
image_list[4] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b4-a.jpg");
image_list[5] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b5-a.jpg");
image_list[6] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b6-a.jpg");
image_list[7] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b7-a.jpg");
image_list[8] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b8-a.jpg");
image_list[9] = new imageItem("http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b9-a.jpg");

//下面为图片的说明文字
note_list[0] = "我爱美女之酷图垂涎三尺";
note_list[1] = "我爱美女之酷图垂涎三尺";
note_list[2] = "我爱美女之酷图垂涎三尺";
note_list[3] = "我爱美女之酷图垂涎三尺";
note_list[4] = "我爱美女之酷图垂涎三尺";
note_list[5] = "我爱美女之酷图垂涎三尺";
note_list[6] = "我爱美女之酷图垂涎三尺";
note_list[7] = "我爱美女之酷图垂涎三尺";
note_list[8] = "我爱美女之酷图垂涎三尺";
note_list[9] = "我爱美女之酷图垂涎三尺";

function noteArray(size)
{this.length=size; for(i=1;i<=size;i++)
{this[i]=""}return this;}
function counternum(){if( timesnum < 10-1){timesnum++;
document.all.slide_ent.src="about:blank";
document.all.slide_ent.src="";}

}function run(obj){
interval=obj.options[obj.selectedIndex].value*1000;rotateImage();}
function stop(){ interval=0;}function previous(){ var new_image = getPreviousImage();document['rImage'].src = new_image;
}function next(){var new_image = getNextImage();

document['rImage'].src = new_image;}
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;}
function noteItem(note) {this.note_item = new Image();
this.note_item.src = note;}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)}
function get_NoteItemLocation(noteObj) {
return(noteObj.note_item.src)}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getPreviousImage() {
image_index = image_index-1;
if (image_index < 0){
 image_index=image_index+10; }
var new_image = get_ImageItemLocation(image_list[image_index]);
document.all.span_1.innerText=image_index+1;
document.all.summary.innerText=note_list[image_index];
return(new_image);}
function getNextImage() {
image_index = image_index+1;
if (image_index >= 10){
 image_index=image_index-10; }
var new_image = get_ImageItemLocation(image_list[image_index]);
document.all.span_1.innerText=image_index+1;
document.all.summary.innerText=note_list[image_index];
return(new_image);}
function rotateImage() {
if (interval == 0){
 return 1;}
if (flagtime == 1){
 var now = new Date();
 var time1 = now.getTime();
 var time2;
 time1=time1+3000;
 time2=now.getTime();
 while(time2 < time1){
 now = new Date();
 time2=now.getTime(); }
 flagtime=0;}
var new_image = getNextImage();
document['rImage'].src = new_image;
var recur_call = "rotateImage('"+'rImage'+"')";
setTimeout(recur_call,interval);}
// End -->
</script>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<script type="text/javascript" src="http://cn.yimg.com/script/hp/ygcss.js"></script>
</head>
<body bgColor=#ffffff topmargin=0 leftmargin=0>

<center>
<center>
<table width="468" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFF2DF">
<tr><td valign="top" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-bottom:solid 1px #766D7C;">
<tr>
</tr>
</table><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#9F90CC" style="border-top:solid 1px #ffffff;">
<tr>
<td height="25" valign="bottom">
<!---->
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
<td style="text-indent:5px;"></td><td width="100%">
<table width="98%" cellspacing="0" cellpadding="0" border="0">
<tr align="center">
<td nowarp><big><b><FONT color=#0000ff>酷图播放:</FONT></b></big></td>
<td nowrap width=10%><FONT color=#0000ff>友情链接</FONT></td><td></td>
<td width="10%" nowrap ><A href="http://blog.sina.com.cn/binghe2008" target=_blank>作者</A></td><td></td>
<td width="10%" nowrap><A href="http://bh.xoyoz.com/luntan/" target=_blank>论坛</A></td><td></td>
<td width="10%" nowrap><A href="http://bh.xoyoz.com/bbs" target=_blank>贴吧</A></td><td></td>
<td width="10%" nowrap><A href="http://bh.xoyoz.com/blog" target=_blank>博客</A></td><td></td>
<td width="10%" nowrap><A href="http://bh.xoyoz.com/talk" target=_blank>聊天</A></td><td></td>
<td width="14%" nowrap><A href="http://bh.xoyoz.com/book/" target=_blank>留言</A></td></tr></table></td><td></td></tr></table>
<!--/--></td></tr><tr>
<td><img src="http://cn.yimg.com/i/cn/sp/slide/slideshow_bg.gif" width="468" height="3" border="0"></td></tr></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="13"></td></tr>
</table>

<!--img447*333-->
<table width="447" height="333" border="0"cellspacing="0"cellpadding="0">
<tr><td align="center"><img name="rImage" src=http://cn.yimg.com/sp/slideshow/biz/i20050429t110509b0-a.jpg onload="counternum()" border="0"></td></tr></table>
<!--/img447*333-->
<!--text-->
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
<td align="center" id="summary" height="28"></td></tr></table>
<!--/text-->
<!--bottom-->
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
<td><img src=http://cn.yimg.com/i/cn/sp/slide/slideshow_bg_3.gif

width="468" height="4" border="0"></td></tr><tr>
<td bgcolor="#C9BEEB" height="25">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<form name=form1><tr>
<td width="80"></td>
<td class="sbody" align="left"><span id=span_1>1</span>/10&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://s6.sinaimg.cn/orignal/48e939f1b10aa8d729a15" width="35" height="21" align="absmiddle" border="0" alt="开始" onclick="run(document.form1.select1)">&nbsp;&nbsp;<img src="http://s10.sinaimg.cn/orignal/48e939f118e3357608ba9" width="35" height="21" align="absmiddle" border="0" alt="停止" onclick="stop()">
&nbsp;&nbsp;<img src="http://s10.sinaimg.cn/orignal/48e939f12c55a9590dba9" width="35" height="21" align="absmiddle" border="0" alt="前一张" onclick="previous()">&nbsp;&nbsp;<img src="http://s4.sinaimg.cn/orignal/48e939f12fed7ce6b9853" width="35" height="21" align="absmiddle" border="0" alt="后一张" onclick="next()">&nbsp;&nbsp;速度:
<select name="select1" onchange="run(this)">
<option value="12">12 秒钟</option>
<option selected value="6">6 秒钟</option>
<option value="3">3 秒钟</option>
<option value="9">9 秒钟</option>

</select></td></tr></form></table></td></tr><tr>
<td height="1" bgcolor="#625A68"></td>
</tr>
</table>
<!--/bottom-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-top:solid 1px #ffffff;border-bottom:solid 1px #ffffff;">
<tr></tr></table></td></tr></table>
<!--/--></center>
<script language=javascript>
flagtime=1;
rotateImage();
slideit()
</script></body></html>


代码说明:

把上述代码中的红色标记的图片地址换成自己的图片地址,然后将代码复制到记事本,另存为"xxx.html"的文件名(网页的形式)。将其上传到网络空间得到你要调用的网址。例如:http://bh.xoyoz.com/web/photo.html 

 

新浪博客调用的代码如下:

<center><iframe src="要调用的网址" width="468" height="433" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></center>

 

图片播放器效果展示:

 


 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有