<html><head></head>
<body>
<script language="Javascript">
<!--
function getCookieVal(offset){
var endstr=document.cookie.indexOf(";",offset);
if(endstr==-1)
endstr=document.cookie.length;
return unescape(document.cookie.substring(offset,endstr));
}
function FixCookieDate(date){
var base=new Date(0);
var skew=base.getTime();
if(skew>0)
base.setTime(base.getTime()-skew);
}
function GetCookie(name){
var arg=name+"=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while(i<clen){
var j=i+alen;
if(document.cookie.substring(i,j)==arg)
return getCookieVal(j);
i=document.cookie.indexOf(" ",i)+1;
if(i==0) break;
}
return null;
}
var expdate=new Date();
FixCookieDate(expdate);
expdate.setTime(expdate.getTime()+(5*60*1000));
countimg=(GetCookie("countimg")!=null)?(GetCookie("countimg")-1):-1;
countimg=(countimg<-1)?-1:countimg;
imgarray=new Array(4);
if(document.images){
imgarray[0]=new Image(205,56);
imgarray[1]=new Image(205,56);
imgarray[2]=new Image(205,56);
imgarray[3]=new Image(205,56);
}
else{
imgarray[0]="";
imgarray[1]="";
imgarray[2]="";
imgarray[3]="";
}
imgarray[0].src="1.jpg";
imgarray[0].URL="http://www.sohu.com";
imgarray[1].src="2.jpg";
imgarray[1].URL="http://www.yahoo.com";
imgarray[2].src="3.jpg";
imgarray[2].URL="http://www.263.com";
imgarray[3].src="4.jpg";
imgarray[3].URL="http://www.chinaren.com";
function updateim(countimg){
return countimg;
}
function overhref2(){
updateim(countimg);
if(imgarray[countimg]!=null){
window.status=imgarray[countimg].URL;
return true;
}
}
function outhref2(){
window.status="";
return true;
}
function clickhref2(){
updateim(countimg);
if(imgarray[countimg]!=null){
location=imgarray[countimg].URL;
}
}
function showimage(){
countimg++;
if(document.images){
if(countimg>imgarray.length-1){
countimg=imgarray.length-imgarray.length;
}
document.images.banner.src=imgarray[countimg].src;
exbannerID=setTimeout("showimage()",1000);
}
}
function setit2(){
updateim(countimg);
document.cookie="countimg="+countimg+"; expires="+expdate.toGMTString();
}
function getit2(){
countimg=(GetCookie("countimg")!=null)?(GetCookie("countimg")):0;
updateim(countimg);
if(exbannerID!=null){
clearTimeout(exbannerID);
showimage();
}
}
function initCookies(){
window.onunload=setit2;
window.onfocus=getit2;
window.onblur=setit2;
}
function initBanner(){
showimage();
cookieID=setTimeout("initCookies()",1000);
}
window.onload=initBanner
//-->
</script>
<a href="" onClick="clickhref2()" onMouseOver="overhref2();return true;"
onMouseOut="outhref2();return true;"><img src="" name="banner" width="500"
height="400" border="0"></a>
</body></html>
就是代码中红色的部分.点击不能打开http://www.sohu.com等的网页,而是打开了F:\asp备份(我的文件是保存在F:\asp备份文件夹中的).
[此贴子已经被作者于2007-4-29 20:31:08编辑过]