您好!欢迎您光临本站! 体育 I 论坛 I 交友 I

会员注册

I

本站搜索

I

收藏本站

当前位置:首页 >>>网络课堂>>>网页代码教程>>>网页特效--自动变换的图像及链接
网页特效--自动变换的图像及链接
发表日期:2007/11/16 20:10:00 出处:未知 作者:未知 发布人:jxhp 已被访问 1190

<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(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.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;   } 

//  assign expiration date variable for cookie

var expdate = new Date ();
FixCookieDate(expdate);
expdate.setTime(expdate.getTime() + (5 * 60 * 1000)) // 5 minutes 

//  initialize countimg variable to track images
countimg = (GetCookie("countimg") != null) ? (GetCookie("countimg")-1) : -1
countimg = (countimg <-1) ? -1 : countimg
IMGArray = new Array(3)

if (document.images) {
 IMGArray[0] = new Image(205,56)
 IMGArray[1] = new Image(205,56)
 IMGArray[2] = new Image(205,56)   }

// Old browsers get an array of empty strings

else {
 IMGArray[0] = ""
 IMGArray[1] = ""
 IMGArray[2] = ""       }
<!-- 改变下面的三个图像的地址及相应的链接地址-->
IMGArray[0].src = "upload/yang1.jpg"
IMGArray[0].URL = "upload/yang.jpg"
IMGArray[1].src = "upload/maling.jpg"
IMGArray[1].URL = "upload/kailing.jpg"
IMGArray[2].src = "upload/yangya4.jpg"
IMGArray[2].URL = "upload/yaliwei.jpg"


function updateIM(countimg) { return countimg; }

//  functions for onMouseOver, onMouseOut, onClick event handlers

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 }}

//  Image swapping function

function showIMAGE() { updateIM(countimg++)

if (document.images) {

// Make sure countimg does''''nt get too big

 if ( countimg > IMGArray.length - 1 ) { countimg = IMGArray.length - IMGArray.length }

 document.images.banner.src = IMGArray[countimg].src
 exbannerID = setTimeout("showIMAGE()",2500) }}


function setIt2() { updateIM(countimg)
 document.cookie = "countimg=" + countimg + "; expires=" + expdate.toGMTString()  }

//  get cookie countimg onblur, onload

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" border="0" ></a>

双击自动滚屏 【打印本页】 【关闭窗口
 相关评论:

没有相关评论

 发表评论:

身份选择:会员 游客(游客不需要输入密码)
用 户 名: 密 码:
评论内容:
(最多评论字数:500)

烟雨亭-透明FLASH|QQ空间FLASH|音乐|动漫|图片|教程|娱乐| | 设为首页 | 加入收藏 | 联系我们 | 进入管理 | 关于站长 | 本站搜索

联系电话:QQ:804994046 E-mail:jxhp16789@163.com 联系人:梦幻