zoukankan      html  css  js  c++  java
  • JS图片切换带超链接

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <title></title>
    </head>
    <body style="margin:0px; padding:0px;">
    <table width="955" height="93" style=" margin:0px; padding:0px;" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="955" height="93">

    <script language="JavaScript"> //js代码

    var bannerAD = new Array(); //用于存放图片路径(相对路径)

    var adNum = 0;

    bannerAD[
    0] = "image/banner1.gif";

    bannerAD[
    1] = "image/banner111.jpg";

    var cljjh = new Array();

    cljjh[
    0] = "TWHP.aspx?id=1&skin=ZH";

    cljjh[
    1] = "TWHP.aspx?id=1&skin=EN";

    function setTransition() {

    if (document.all) {

    bannerADrotator.filters.revealTrans.Transition
    = Math.floor(Math.random() * 23); //设置图片切换

    bannerADrotator.filters.revealTrans.apply();
    //应用图片切换

    }

    }

    function playTransition() {

    if (document.all)

    bannerADrotator.filters.revealTrans.play()
    //播放图片

    }

    function nextAd() {

    if ((adNum < bannerAD.length - 1)&(adNum < cljjh.length - 1)) adNum++;

    else adNum = 0;

    setTransition();

    document.images.bannerADrotator.src
    = bannerAD[adNum];
    document.getElementById(
    "cljaa").href = cljjh[adNum];
    playTransition();

    theTimer
    = setTimeout("nextAd()", 5000); //5秒钟切换一张图片

    }

    </script>

    <a target="_parent" id="cljaa" href="" name="clj"><img style="filter: revealTrans(duration=2,transition=20)" height="93" src="" width="955"
    border
    ="0" name="bannerADrotator"></a>

    <script language="javascript" type="text/javascript"> nextAd()</script>

    </td>
    </tr>
    </table>
    </body>
    </html>

  • 相关阅读:
    JavaScript 入门之常见对象
    JavaScript 快速入门
    高级程序设计语言的共性内容
    CSS 快速入门
    HTML 快速入门
    正则表达式
    Oracle 11g安装
    部分框架结构图
    java定时器
    java垃圾回收机制的使用
  • 原文地址:https://www.cnblogs.com/XuYiHe/p/2186450.html
Copyright © 2011-2022 走看看