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>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>广告代码_http://www.111cn.net</title>
<style type="text/css教程">
/* reset style */
* { margin:0; padding:0; word-break:break-all; }
body { background:#fff; color:#333; font:12px/1.6em helvetica, arial, sans-serif; }
h1, h2, h3, h4, h5, h6 { font-size:1em; }
a { color:#039; text-decoration:none; }
 a:hover { text-decoration:underline; }
ul, li { list-style:none; }
fieldset, img { border:none; }
em, strong, cite, th { font-style:normal; font-weight:normal; }
/* focus_change style */
#focus_change { position:relative; width:450px; height:295px; overflow:hidden; margin:20px 0 1px 60px; }
 #focus_change_list { position:absolute; width:1800px; height:295px; }
  #focus_change_list li { float:left; }
  #focus_change_list li img { width:450px; height:295px; }
 .focus_change_opacity { position:absolute; width:450px; height:70px; top:225px; left:0; background:#000; filter:alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5; }
 #focus_change_btn { position:absolute; width:450px; height:65px; top:225px; left:0; }
  #focus_change_btn ul { padding-left:5px; }
  #focus_change_btn li { display:inline; float:left; margin:0 15px; padding-top:12px; }
  #focus_change_btn li img { width:76px; height:50px; border:2px solid #888; }
  #focus_change_btn .current { background:url(icon_arrow.gif) no-repeat 37px 8px;}
  #focus_change_btn .current img { border-color:#eee; }
</style>
<script type="text/网页特效">
function $(id) { return document.getelementbyid(id); }
function moveelement(elementid,final_x,final_y,interval) {
  if (!document.getelementbyid) return false;
  if (!document.getelementbyid(elementid)) return false;
  var elem = document.getelementbyid(elementid);
  if (elem.movement) {
    cleartimeout(elem.movement);
  }
  if (!elem.style.left) {
    elem.style.left = "0px";
  }
  if (!elem.style.top) {
    elem.style.top = "0px";
  }
  var xpos = parseint(elem.style.left);
  var ypos = parseint(elem.style.top);
  if (xpos == final_x  &&  ypos == final_y) {
  return true;
  }
  if (xpos < final_x) {
    var dist = math.ceil((final_x - xpos)/10);
    xpos = xpos + dist;
  }
  if (xpos > final_x) {
    var dist = math.ceil((xpos - final_x)/10);
    xpos = xpos - dist;
  }
  if (ypos < final_y) {
    var dist = math.ceil((final_y - ypos)/10);
    ypos = ypos + dist;
  }
  if (ypos > final_y) {
    var dist = math.ceil((ypos - final_y)/10);
    ypos = ypos - dist;
  }
  elem.style.left = xpos + "px";
  elem.style.top = ypos + "px";
  var repeat = "moveelement('"+elementid+"',"+final_x+","+final_y+","+interval+")";
  elem.movement = settimeout(repeat,interval);
}
function classnormal(){
 var focusbtnlist = $('focus_change_btn').getelementsbytagname('li');
 for(var i=0; i<focusbtnlist.length; i++) {
  focusbtnlist[i].classname='';
 }
}
function focuschange() {
 var focusbtnlist = $('focus_change_btn').getelementsbytagname('li');
  focusbtnlist[0].onmouseo教程ver = function() {
   moveelement('focus_change_list',0,0,5);
   classnormal()
   focusbtnlist[0].classname='current'
  }
  focusbtnlist[1].onmouseover = function() {
   moveelement('focus_change_list',-450,0,5);
   classnormal()
   focusbtnlist[1].classname='current'
  }
  focusbtnlist[2].onmouseover = function() {
   moveelement('focus_change_list',-900,0,5);
   classnormal()
   focusbtnlist[2].classname='current'
  }
  focusbtnlist[3].onmouseover = function() {
   moveelement('focus_change_list',-1350,0,5);
   classnormal()
   focusbtnlist[3].classname='current'
  }
}
setinterval('autofocuschange()', 5000);
function autofocuschange() {
 var focusbtnlist = $('focus_change_btn').getelementsbytagname('li');
 for(var i=0; i<focusbtnlist.length; i++) {
  if (focusbtnlist[i].classname == 'current') {
   var currentnum = i;
  }
 }
 if (currentnum==0 ){
  moveelement('focus_change_list',-450,0,5);
  classnormal()
  focusbtnlist[1].classname='current'
 }
 if (currentnum==1 ){
  moveelement('focus_change_list',-900,0,5);
  classnormal()
  focusbtnlist[2].classname='current'
 }
 if (currentnum==2 ){
  moveelement('focus_change_list',-1350,0,5);
  classnormal()
  focusbtnlist[3].classname='current'
 }
 if (currentnum==3 ){
  moveelement('focus_change_list',0,0,5);
  classnormal()
  focusbtnlist[0].classname='current'
 }
}
window.onload=function(){
 focuschange();
}
</script>
</head>
<body>
<div id="focus_change">
 <div id="focus_change_list" style="top:0; left:0;">
  <ul>
  <li><img src="img/01.jpg"/></li>
  <li><img src="img/02.jpg"/></li>
  <li><img src="img/03.jpg"/></li>
  <li><img src="img/04.jpg"/></li>
  </ul>
 </div>
 <div class="focus_change_opacity"></div>
 <div id="focus_change_btn">
  <ul>
  <li class="current"><a href="#"><img src="img/btn_01.jpg" alt="" /></a></li>
  <li><a href="#"><img src="img/btn_02.jpg"/></a></li>
  <li><a href="#"><img src="img/btn_03.jpg"/></a></li>
  <li><a href="#"><img src="img/btn_04.jpg"/></a></li>
  </ul>
 </div>
</div><!--focus_change end-->
<br />
<a href="http://www.111cn.net/" target="_blank" style="font-size:14px; color:#003366; margin-left:180px;">整理自壹聚教程网</a>
</body>
</html>

源码下载地址
http://down.111cn.net/down/code/js/xiangcedaima/2010/0911/20752.html

时间: 2024-07-30 07:50:29

js焦点图广告代码的相关文章

Jquery焦点图实例代码_jquery

本文实例讲述了Jquery焦点图实例代码.分享给大家供大家参考.具体如下: 对于很多建站的朋友来讲,焦点图并不陌生,一般的企业站,门户站都会用到焦点图.我们平时在写html代码的时候,很多人为了省时省力,对于焦点图都是在网上下载一些人家写好的代码,直接套上去即可,很多时候我自己也是这样来的.因为一个焦点图有html布局,css样式调试和最关键的 javascript语句的编写.这些都是一个很麻烦的过程. 今天我就以实例讲解,手把手教你如何写Jquery焦点图.Jquery是js封装的框架,让js

jQuery横向擦除焦点图特效代码分享_jquery

本文实例讲述了jQuery横向擦除焦点图特效.分享给大家供大家参考.具体如下: 迅雷jQuery横向擦除焦点图是一款基于jQuery实现的7屏横向擦除焦点图代码,有缩略图和标题,可以自定义标题. 运行效果图:-------------------查看效果 下载源码------------------- 小提示:浏览器中如果不能正常运行,可以尝试切换浏览模式. (1)在head区域引入CSS样式: <link rel="stylesheet" href="css/zzsc

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> <meta http-equiv="content-

js浮动对联广告代码[支持flash]

提示:您可以先修改部分代码再运行 js浮动对联广告代码[支持flash] 对联广告带同时关闭的

纯JS焦点图特效实例(可一个页面多用)_javascript技巧

实例如下: <!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> <meta http-equiv="Co

实用的js 焦点图切换效果 结构行为相分离_javascript技巧

焦点图切换效果,对前端来说,恐怕再熟悉不过了,实现它的方法应该有多种,工作当中常用的一种,叙述如下: 如何让当前的数字导航与图片的显示同步? 这里有两个区域,图片切换区和数字导航区:分别对应着两个循环函数:plays(value)和setBg(value): 当图片循环切换到第2张时,此时数字导航的当前状态也变换到第2的位置,以此达到一种同步的效果,这里的关键就是给他们传递相同的参数value:而这个任务就交给了函数Mea(value): 图片应该是自动切换的,当循环显示到最后一种图片后,返回到

Flash+Js焦点图切换效果

本文章免费提供一款由代码下载哦,这款flash效果的图片切换源码是一款我从网上找到的,现在把源码拿出来给各位朋友看看哦,好了费话不说多了喜欢就把这款焦点图代码下载吧. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-eq

小米官网jQuery焦点图实例代码

HTML代码  代码如下 复制代码 <div class="focus">              <div id="xmSlide" class="xmSlide">                  <div class="xmSlide_01"></div>                  <div class="xmSlide_02">

js 右下角浮动广告代码(四种代码)

// 随即广告 document.write("<span id="tmpmsgdiv"></span>"); var randoms=math.floor(math.random()*5+1); if(randoms%2==0){    str="<a href="http://www.111cn.net/?tn=codefans" target="_blank"><img