最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

javascript實(shí)現(xiàn)循環(huán)廣告條效果

 更新時(shí)間:2017年12月12日 10:32:05   作者:shursulei  
這篇文章主要為大家詳細(xì)介紹了javascript實(shí)現(xiàn)循環(huán)廣告條效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了javascript實(shí)現(xiàn)循環(huán)廣告條的具體代碼,供大家參考,具體內(nèi)容如下

html代碼:

<!DOCTYPE html>
<html>
<head>
<title>Rotating Banner</title>
<script src="script07.js"></script>
<link rel="stylesheet" href="script01.css" rel="external nofollow" >
</head>
<body>
<div class="centered">
<img src="images/reading1.gif" id="adBanner" alt="Ad Banner">
</div>
</body>
</html>

css代碼:

body {
background-color: white;
color: black;
font-size: 20px;
font-family: "Lucida Grande", Verdana,Arial, Helvetica, sans-serif;
}
h1, th {
font-family: Georgia, "Times New Roman",Times, serif;
}
h1 {
font-size: 28px;
}
table {
border-collapse: collapse;
}
th, td {
padding: 10px;
border: 2px #666 solid;
text-align: center;
width: 20%;
}
#free, .pickedBG {
background-color: #f66;
}
.winningBG {
background-image:url(images/redFlash.gif);
}

js代碼:

window.onload = rotate;
var thisAd = 0;
function rotate() {
var adImages = new Array("images/ reading1.gif","images/reading2. gif","images/reading3.gif");
thisAd++;
if (thisAd == adImages.length) {
thisAd = 0;
}
document.getElementById("adBanner").src = adImages[thisAd];
setTimeout(rotate, 3 * 1000);//設(shè)置時(shí)間,本每隔多長(zhǎng)時(shí)間改變廣告條中的GIF
}

在循環(huán)廣告條中添加鏈接:修改js的代碼

window.onload = initBannerLink;
var thisAd = 0;
function initBannerLink() {
if (document.getElementById("adBanner").parentNode.tagName == "A") {
document.getElementById("adBanner").parentNode.onclick = newLocation;
}
rotate();
}
function newLocation() {
var adURL = new Array("negrino.com","sun.com","microsoft.com");
document.location.href = "http://www." + adURL[thisAd];
return false;
}
function rotate() {
var adImages = new Array("images/ reading1.gif","images/reading2. gif","images/reading3.gif");
thisAd++;
if (thisAd == adImages.length) {
thisAd = 0;
}
document.getElementById("adBanner").src = adImages[thisAd];
setTimeout(rotate, 3 * 1000);//設(shè)置時(shí)間,本每隔多長(zhǎng)時(shí)間改變廣告條中的GIF
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

滨州市| 高唐县| 德惠市| 漳州市| 四平市| 衡阳市| 寿宁县| 水富县| 莆田市| 夏邑县| 黄大仙区| 永靖县| 宁津县| 肥西县| 安宁市| 巴林左旗| 葵青区| 焉耆| 阿荣旗| 德保县| 大埔区| 额济纳旗| 井冈山市| 神木县| 富川| 北川| 岳普湖县| 建昌县| 山阴县| 凤城市| 磐石市| 温宿县| 乐陵市| 武川县| 平谷区| 襄垣县| 连山| 乐至县| 从化市| 互助| 阿瓦提县|