求解连接随机改变

buerke 2010-12-17 02:12:51

这些方格中有一个是连接,如何实现每刷新一次页面,连接随机在其中一个方格里?
不难理解吧~~跪求.....解答
...全文
89 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
buerke 2010-12-17
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 getserved 的回复:]
JScript code

function refreshImg(){
var lastTar = $(".hasUrl").eq(0);
$(lastTar).removeClass("hasUrl");
$(lastTar).unbind("click");
var ram = parseInt(Math.random() * (24 -……
[/Quote]我还是把原文代码发下吧
<style type="text/css">
<!--
body {
background-color: #000000;
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
body,td,th {
color: #FFFFFF;
font-size: 12px;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<title>不言不语</title>
<body onload="MM_preloadImages('/image/bai.jpg','/image/hui.jpg')"><table width="100%" height="100%" align="center">
<tr>
<td align="center" valign="middle"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image1" width="30" height="30" border="0" id="Image1" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1',','/image/bai.jpg',1)"></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image2" width="30" height="30" border="0" id="Image2" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image3" width="30" height="30" border="0" id="Image3" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image4" width="30" height="30" border="0" id="Image4" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image5" width="30" height="30" border="0" id="Image5" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image6" width="30" height="30" border="0" id="Image6" /></a><br/><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image7" width="30" height="30" border="0" id="Image7" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image8" width="30" height="30" border="0" id="Image8" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image9" width="30" height="30" border="0" id="Image9" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image10" width="30" height="30" border="0" id="Image10" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image11" width="30" height="30" border="0" id="Image11" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image12','','/image/bai.jpg',0)"><img src="/image/hui.jpg" name="Image12" width="30" height="30" border="0" id="Image12" /></a><br/><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image13','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image13" width="30" height="30" border="0" id="Image13" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image14','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image14" width="30" height="30" border="0" id="Image14" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image15','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image15" width="30" height="30" border="0" id="Image15" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image16" width="30" height="30" border="0" id="Image16" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image17','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image17" width="30" height="30" border="0" id="Image17" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image18','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image18" width="30" height="30" border="0" id="Image18" /></a><br/><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image19','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image19" width="30" height="30" border="0" id="Image19" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image20','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image20" width="30" height="30" border="0" id="Image20" /></a><a href="/个人/index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image21','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image21" width="30" height="30" border="0" id="Image21" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image22','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image22" width="30" height="30" border="0" id="Image22" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image23','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image23" width="30" height="30" border="0" id="Image23" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image24','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image24" width="30" height="30" border="0" id="Image24" /></a><br /><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image25','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image25" width="30" height="30" border="0" id="Image25" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image26','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image26" width="30" height="30" border="0" id="Image26" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image27','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image27" width="30" height="30" border="0" id="Image27" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image28','','/image/hui.jpg',1)"><img src="/image/bai.jpg" name="Image28" width="30" height="30" border="0" id="Image28" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image29','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image29" width="30" height="30" border="0" id="Image29" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image30','','/image/bai.jpg',1)"><img src="/image/hui.jpg" name="Image30" width="30" height="30" border="0" id="Image30" /></a><br>你能找到入口吗?</td></tr></table></body>
getserved 2010-12-17
  • 打赏
  • 举报
回复

function refreshImg(){
var lastTar = $(".hasUrl").eq(0);
$(lastTar).removeClass("hasUrl");
$(lastTar).unbind("click");
var ram = parseInt(Math.random() * (24 - 0) + 0);
var url = "doAnything.action";
var tar = $("#square"+ram);
$(tar).addClass("hasUrl");
$(tar).bind("click"),function(e){
window.open(url,"_blank","");
});
}


<img id="square0" border=0 src="img" />
<img id="square1" border=0 src="img" />
...
<img id="square23" border=0 src="img" />

<input type="button" onclick="refreshImg()" />
buerke 2010-12-17
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 yhtapmys 的回复:]
不解!
[/Quote].......难道不能用CSS JS实现?
在线等答案
yhtapmys 2010-12-17
  • 打赏
  • 举报
回复
不解!

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧