»
Tiếng AnhTiếng PhápTiếng Việt

In - Hiệu ứng chuyển ảnh - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Hình ảnh » Chuyển ảnh » Hiệu ứng chuyển ảnh
URL: https://www.javascriptbank.com/banner-ad-rotator.html

Hiệu ứng chuyển ảnh © JavaScriptBank.comHiệu ứng JavaScript này sẽ chuyển đổi ảnh sau một khoảng thời gian xác định. Bạn có thể áp dụng hiệu ứng JavaScript này với nhiều hình ảnhliên kết như bạn muốn.

Phiên bản đầy đủ: jsB@nk » Hình ảnh » Chuyển ảnh » Hiệu ứng chuyển ảnh
URL: https://www.javascriptbank.com/banner-ad-rotator.html



CSS
<style type="text/css"><!--#addbox {  position: relative;  width: 500px;  height: 70 px;  clip: rect(0px, 500px, 0px, 70px);  overflow: hidden;}#banner1 {  position: relative;  width: 150px;  height: 60px;  top: 0px;}#banner2 {  position: relative;  width: 150px;  height: 60px;  top: 0px;}--></style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script type="text/javascript"><!--//Created by: Ben Kanaev :: http://www.webhostreview.biz//Adaptation for Netscape and Firefox by Fangvar displayTime, speed, wait, banner1, banner2, link1, link2, bannerIndex, bannerLocations, bannerURLs;function initVar() {  displayTime = 1; // The amount of time each banner will be displayed in seconds.  speed = 5; // The speed at which the banners is moved (1 - 10, anything above 5 is not recommended).  wait = true;  banner1 = document.getElementById("banner1");  banner2 = document.getElementById("banner2");  link1 = document.getElementById("link1");  link2 = document.getElementById("link2");  banner1 = document.getElementById("banner1");  banner2 = document.getElementById("banner2");  banner1.style.left = 0;  banner2.style.left = 500;  bannerIndex = 1;  /* Important: In order for this script to work properly, please make sure that the banner graphic and the  URL associated with it have the same index in both, the bannerLocations and bannerURLs arrays.  Duplicate URLs are permitted. */  // Enter the location of the banner graphics in the array below.  bannerLocations = new Array("gif_logojsb2.gif","gif_logojsb2.gif","gif_logojsb2.gif");  // Enter the URL's to which the banners will link to in the array below.  bannerURLs = new Array("http://www.javascriptbank.com","http://www.javascriptbank.com","http://www.javascriptbank.com");}function moveBanner(){  if(!wait){    banner1.style.left = parseInt(banner1.style.left) -  (speed * 5);    banner2.style.left = parseInt(banner2.style.left) - (speed * 5);    if(parseInt(banner1.style.left) <= -500){      banner1.style.left = 500;      bannerIndex = (bannerIndex < (bannerLocations.length - 1)) ? ++bannerIndex :0;      banner1.src = bannerLocations[bannerIndex];      link1.href = bannerURLs[bannerIndex];      wait = true;    }    if(parseInt(banner2.style.left) <= -500){      banner2.style.left = 500;      bannerIndex = (bannerIndex < (bannerLocations.length - 1)) ? ++bannerIndex :0;      banner2.src = bannerLocations[bannerIndex];      link2.href = bannerURLs[bannerIndex];      wait = true;    }    setTimeout("moveBanner()",100);  } else {      wait = false;      setTimeout("moveBanner()", displayTime * 1000);  }}--></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onLoad="initVar(); moveBanner()"><div name="addbox" id="addbox" style="border: 1px solid black;"><a name="link1" id="link1" href="http://www.javascriptbank.com"><img border="0" name="banner1" id="banner1" src="../../jsbsource/gif_logojsb.gif"></a><a name="link2" id="link2" href="http://www.javascriptbank.com"><img border="0" name="banner2" id="banner2" src="../../jsbsource/gif_logojsb2.gif"></a></div></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->