主题:  如何使网页刷新后自动换图片?

语笑嫣然

职务:普通成员
等级:1
金币:1.0
发贴:105
#12005/7/5 21:27:36
RT,比如网页有 1.jpg、2.jpg、3.jpg、4.jpg、5.jpg 5个图片,如何让网页随机显示图片?

谢谢



wxl168168

职务:普通成员
等级:1
金币:0.0
发贴:15
#22005/7/6 0:26:58
使用DM的轮换图象他自已会变啊!真笨!



语笑嫣然

职务:普通成员
等级:1
金币:1.0
发贴:105
#32005/7/6 6:52:12
wxl168168在上个帖子中说
引用:
使用DM的轮换图象他自已会变啊!真笨!

在哪?我笨,教我……



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
#42005/7/13 17:43:18

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]



语笑嫣然

职务:普通成员
等级:1
金币:1.0
发贴:105
#52005/7/18 21:09:38
行者在上个帖子中说
引用:

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]



感谢~但是这个代码为什么刷新一次后都短暂的显示那个小叉叉呢?很不美观啊……

看这里:http://www.spirit.org.cn/index_.html

谁能解决一下?



语笑嫣然

职务:普通成员
等级:1
金币:1.0
发贴:105
#62005/7/18 21:14:41
引用:
<html>
<head>
<title>Junior.Spirit</title>
<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5)">
<style type="text/css">
<!--
body {
	background-color: #666666;
	margin-top: 0px;
	SCROLLBAR-FACE-COLOR: #666666;
    SCROLLBAR-HIGHLIGHT-COLOR: #666666;
	SCROLLBAR-SHADOW-COLOR: #666666;
	SCROLLBAR-3DLIGHT-COLOR: #666666;
	SCROLLBAR-ARROW-COLOR: #666666;
	SCROLLBAR-TRACK-COLOR: #666666;
	SCROLLBAR-DARKSHADOW-COLOR: #666666;
}
body,td,th {
	color: #FFFFFF;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
}
a:link {
	color: #FFFFFF;
	text-decoration: none;
}
a:visited {
	color: #FFFFFF;
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.style2 {
	font-size: 9px;
	color: #CCCCCC;
}
.style4 {color: #FFFFFF; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px;}
-->
</style>
<script language=JavaScript>
<!--

NumberOfImages = 11;

ImageFiles = new Array (NumberOfImages);
        ImageFiles[0] = "images/logo_/logo_0.gif";
        ImageFiles[1] = "images/logo_/logo_1.gif";
        ImageFiles[2] = "images/logo_/logo_2.gif";
        ImageFiles[3] = "images/logo_/logo_3.gif";
        ImageFiles[4] = "images/logo_/logo_4.gif";
        ImageFiles[5] = "images/logo_/logo_5.gif";
        ImageFiles[6] = "images/logo_/logo_6.gif";
        ImageFiles[7] = "images/logo_/logo_7.gif";
        ImageFiles[8] = "images/logo_/logo_8.gif";
        ImageFiles[9] = "images/logo_/logo_9.gif";
        ImageFiles[10] = "images/logo_/logo_10.gif";

ImageWidth = new Array (NumberOfImages);
        ImageWidth[0] = 390;
        ImageWidth[1] = 390;
        ImageWidth[2] = 390;
        ImageWidth[3] = 390;
        ImageWidth[4] = 390;
        ImageWidth[5] = 390;
        ImageWidth[6] = 390;
        ImageWidth[7] = 390;
        ImageWidth[8] = 390;
        ImageWidth[9] = 390; 
        ImageWidth[10] = 390;

ImageHeight = new Array (NumberOfImages);
        ImageHeight[0] = 350;
        ImageHeight[1] = 350;
        ImageHeight[2] = 350;
        ImageHeight[3] = 350;
        ImageHeight[4] = 350;
        ImageHeight[5] = 350;
        ImageHeight[6] = 350;
        ImageHeight[7] = 350;
        ImageHeight[8] = 350;
        ImageHeight[9] = 350; 
        ImageHeight[10] = 350;

Border = new Array (NumberOfImages);
		Border[0] = 0;
		Border[1] = 0;
		Border[2] = 0;
		Border[3] = 0;
        Border[4] = 0;
        Border[5] = 0;

HorizontalSpace = new Array(NumberOfImages);
		HorizontalSpace[0] = 0;
		HorizontalSpace[1] = 0;
		HorizontalSpace[2] = 0;
		HorizontalSpace[3] = 0;
        HorizontalSpace[4] = 0;
        HorizontalSpace[5] = 0;

VerticalSpace = new Array(NumberOfImages);
		VerticalSpace[0] = 0;
		VerticalSpace[1] = 0;
		VerticalSpace[2] = 0;
		VerticalSpace[3] = 0;
        VerticalSpace[4] = 0;
        VerticalSpace[5] = 0;

function GenerateRandom(max) {
	var TodaysDate;
	var Seconds;
	var Random;
	
	TodaysDate = new Date();
	Seconds = TodaysDate.getSeconds();
	Random = Seconds%max;
	return Random;
}

function WriteBanner(max) {
	var x;	
	x = GenerateRandom(max);
	
	document.write(LT+"A "+GT+LT+"IMG SRC=\"" + ImageFiles[x]+"\" WIDTH=\""+ImageWidth[x]+"\" HEIGHT=\""+ImageHeight[x]+"\" BORDER=\"" + Border[x] +"\" HSPACE=\"" + HorizontalSpace[x] +"\" VSPACE=\"" + VerticalSpace[x] +"\" "+GT+LT+"/A"+GT);
}


LT = "<"; 
GT = ">"; 

// -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div align="center">
  <table width="670" height="373" border="0" cellpadding="0" cellspacing="0" bordercolor="#666666" bgcolor="#666666">
    <tr>
      <td width="390" height="350" bgcolor="#777777"><div align="center"><script languagne="JavaScript">WriteBanner(NumberOfImages);
      </script></div></td>
      <td width="280" bgcolor="#777777"><hr align="center" size="24" noshade color="#555555">        
      <p align="right"><a href="/"><img src="images/logo.gif" alt="Junior.Spirit" width="128" height="10" border="0"><br />
      </a><span class="style4"><a href="work.html">my_wor</a><br>
          </span><span class="style4"><a href="http://blog.spirit.org.cn/" target="_blank">msn_spac</a><br>
          <a href="http://fish.spirit.org.cn/" target="_blank">fish_homepag</a><br>
          <a href="http://www.7-zip.org/zh-cn/" target="_blank">7-zip_chs_hom</a><br>
          <a href="http://www.donews.net/7zip/" target="_blank">7-zip_update_blo</a><br>
          </span><a href="http://junior-spirit.deviantart.com/" target="_blank">deviantart_pag<br>
        </a><a href="http://spaces.msn.com/members/spaxis/?mkt=en-us" target="_blank">my_histor</a></p>
        <p align="right"><a href="about.html">abou_u</a></p>
        <p align="right">MSN: junior.spirit@163.com</p>
</td>
    </tr>
    <tr>
      <td bgcolor="#555555">&nbsp;</td>
      <td bordercolor="#666666" bgcolor="#666666"><p align="right"><span class="style2">&copy; 2005 <a href="mailto:Junior.Spirit%20%3Cjunior.spirit@163.com%3E">Junior.Spirit</a><br>
      </span></p>
      </td>
    </tr>
  </table>
  <p><hr width="670" size="20" noshade>
  <div align="center">
    <table width="670" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><p>to see the images on this page correctly, you should stop ie blocking the scrips runing and allow to play animated gifs. <br>
          best view at: 1280 × 960, ie 5.0 or higher.</p>        </td>
      </tr>
    </table>
  </div>
</div>
</body>
</html>



这是赵文杰朋友提供的代码,不会有显示红叉的问题,但是 winxp sp2 + ie 6.0 会禁止这代码,说是不安全……

或者谁能帮忙改改这个?感激不尽……



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
#72005/7/18 21:22:44
12345在上个帖子中说
引用:
感谢~但是这个代码为什么刷新一次后都短暂的显示那个小叉叉呢?很不美观啊……

看这里:http://www.spirit.org.cn/index_.html

谁能解决一下?


可以设定图片读取时候时候显示的默认图片的。。。如下。。。

在实际应用中。。把“”换成一个透明的图片就好。。。


[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]



语笑嫣然

职务:普通成员
等级:1
金币:1.0
发贴:105
#82005/7/18 21:45:25
行者在上个帖子中说
引用:
12345在上个帖子中说
引用:
感谢~但是这个代码为什么刷新一次后都短暂的显示那个小叉叉呢?很不美观啊……

看这里:http://www.spirit.org.cn/index_.html

谁能解决一下?


可以设定图片读取时候时候显示的默认图片的。。。如下。。。

在实际应用中。。把“”换成一个透明的图片就好。。。


[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]


感谢!问题解决~



anfuzhen000

职务:普通成员
等级:1
金币:0.0
发贴:7
#92005/8/1 13:10:46
[url=][/url]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rev="made" href="mailto:cn_yanzi@yahoo.com.cn" />
<title></title>
<style type="text/css">
TABLE.a, TD.a { width: 100%; height: 100%; background-color:silver }
TABLE.b, TD.b { background-color:red }
</style>
<script type="text/javascript">
    function createimage() {
        var how_many_ads = 5;
        var now = new Date()
        var sec = now.getSeconds()
        var ad = sec % how_many_ads;
        ad +=1;
        document.getElementById("theimg".src = "http://img013.photo.wangyou.com/2005/7/28/126410/20051122602670" + ad + ".jpg";
    }
    </script>
</head>
<body onload="createimage()">
<p>
    <img src="" id="theimg" width="361" height="536" alt="随机的图片" />
</p>
</body>
</html>



anfuzhen000

职务:普通成员
等级:1
金币:0.0
发贴:7
#102005/8/1 13:12:26
[url=[url=][/url]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rev="made" href="mailto:cn_yanzi@yahoo.com.cn" />
<title></title>
<style type="text/css">
TABLE.a, TD.a { width: 100%; height: 100%; background-color:silver }
TABLE.b, TD.b { background-color:red }
</style>
<script type="text/javascript">
    function createimage() {
        var how_many_ads = 5;
        var now = new Date()
        var sec = now.getSeconds()
        var ad = sec % how_many_ads;
        ad +=1;
        document.getElementById("theimg".src = "http://img013.photo.wangyou.com/2005/7/28/126410/20051122602670" + ad + ".jpg";
    }
    </script>
</head>
<body onload="createimage()">
<p>
    <img src="" id="theimg" width="361" height="536" alt="随机的图片" />
</p>
</body>
</html>][/url]



appleping

职务:普通成员
等级:1
金币:0.0
发贴:7
#112005/8/1 15:50:12
url=[url=][/url]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rev="made" href="mailto:cn_yanzi@yahoo.com.cn" />
<title></title>
<style type="text/css">
TABLE.a, TD.a { width: 100%; height: 100%; background-color:silver }
TABLE.b, TD.b { background-color:red }
</style>
<script type="text/javascript">
function createimage() {
var how_many_ads = 5;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
document.getElementById("theimg".src = "http://img013.photo.wangyou.com/2005/7/28/126410/20051122602670" + ad + ".jpg";
}
</script>
</head>
<body onload="createimage()">
<p>
<img src="" id="theimg" width="361" height="536" alt="随机的图片" />
</p>
</body>
</html>][/url]



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
#122005/8/1 16:19:41
这什么状况这个。。。



语笑嫣然

职务:普通成员
等级:1
金币:1.0
发贴:105
#132005/8/1 18:19:52
?????

都一样啊……



从来侠客都潇洒

职务:普通成员
等级:1
金币:0.0
发贴:46
#142005/8/1 21:55:10
行了最笨的我来了