杭州电脑保姆
用户公告
各位网友好:
    特此申明:本站纯属个人爱好网站,无任何赢利目的,如有涉及侵权-请留言提醒,一定马上删除!
    本站最佳浏览分辨率= 1024 X 768 !
搜索BLOG文章
网友IP追踪



博客基本信息
用户名: lankong
等级: 大学生
在线时间: 4153 分钟
日志总数: 410
评论数量: 448
访问次数: 331220
建立时间: 2007-06-22

我的日志
网页代码下载大全-62007-11-15

图片切换JS网页代码

 
<script language="JavaScript1.1"> 
<!-- 
var slidespeed=1000 
var slideimages=new Array("http://www.smallrain.net/jsimg/1.jpg";,"http://www.smallrain.net/jsimg/2.jpg";,"http://www.smallrain.net/jsimg/3.jpg";) 
var slideimagesTitle=new Array("标题一","标题2","标题3");

var imageholder=new Array() 
var ie55=window.createPopup 
for (i=0;i<slideimages.length;i++){ 
imageholder=new Image() 
imageholder.src=slideimages 
}

function gotoshow(){ 
window.location=slidelinks[whichlink] 
} 
//--> 
</script> 
<script language="JavaScript1.1"> 
</script> 
<img src="http://www.smallrain.net/jsimg/1.jpg"; name="slide" width="256" height="198" border=0 style="filter:progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=15,Duration=1)"> 
<table width="256" height="35" border="0" bgcolor="#999900"> 
  <tr> 
    <td><a href="#" id="linkShow">标题一</a></td> 
  </tr> 
</table> 
<script language="JavaScript1.1"><!-- 
var whichlink=0 
var whichimage=0 
var pixeldelay=(ie55)? document.images.slide.filters[0].duration*1000 : 0 
function slideit(){ 
    if (!document.images)  
        return 
    if (ie55)  
        document.images.slide.filters[0].apply() 
     
    document.images.slide.src=imageholder[whichimage].src 
    document.getElementById("linkShow").href=imageholder[whichimage].src; 
    document.getElementById("linkShow").innerHTML=slideimagesTitle[whichimage];   
     
    if (ie55)  
        document.images.slide.filters[0].play()

    whichlink=whichimage 
    whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0 
     
    setTimeout("slideit()",slidespeed+pixeldelay) 
} 
slideit() 
//--> 
</script> 
  
  
鼠标经过改变透明度

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html> 
<head> 
     <title>Untitled</title> 
</head>

<body background="file:///D:/pconline/code/050425/bg.jpg">

<SCRIPT LANGUAGE="JavaScript"> 
<!-- Begin 
if ((navigator.appName.indexOf('Microsoft')+1)) { 
document.write('<style type="text/css"> .opacity1 {filter:alpha(opacity=50)} .opacity2 {filter:alpha(opacity=100)} </style>'); } 
if ((navigator.appName.indexOf('Netscape')+1)) { 
document.write('<style type="text/css"> .opacity1 {-moz-opacity:0.5} .opacity2 {-moz-opacity:1} </style>'); } 
else { 
document.write(''); } 
//  End --> 
</script> 
<table align="center" cellpadding="10"> 
<tr><td> 
<a href="http://www.pconline.com.cn";> 
<img src="1.jpg" border="0" class="opacity1" onmouseover="this.className='opacity2'" onmouseout="this.className='opacity1'"></a> 
</td><td> 
<a href="http://www.pconline.com.cn/pcedu";> 
<img src="2.jpg" border="0" class="opacity1" onmouseover="this.className='opacity2'" onmouseout="this.className='opacity1'"></a> 
</td></tr> 
</table>

</body> 
</html>  
  
  
滑动层的运用

<DIV id=floater  
            style="LEFT: 799px; POSITION: absolute; TOP: 227px; Z-INDEX: 1"> 
      <SCRIPT language=JavaScript> 
     self.onError=null; 
     currentX = currentY = 0;   
     whichIt = null;            
     lastScrollX = 0; lastScrollY = 0; 
     NS = (document.layers) ? 1 : 0; 
     IE = (document.all) ? 1: 0; 
     <!-- STALKER CODE --> 
     function heartBeat() { 
           if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; } 
         if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; } 
           if(diffY != lastScrollY) { 
                     percent = .1 * (diffY - lastScrollY); 
                     if(percent > 0) percent = Math.ceil(percent); 
                     else percent = Math.floor(percent); 
                             if(IE) document.all.floater.style.pixelTop += percent; 
                             if(NS) document.floater.top += percent;  
                     lastScrollY = lastScrollY + percent; 
         } 
           if(diffX != lastScrollX) { 
                 percent = .1 * (diffX - lastScrollX); 
                 if(percent > 0) percent = Math.ceil(percent); 
                 else percent = Math.floor(percent); 
                 if(IE) document.all.floater.style.pixelLeft += percent; 
                 if(NS) document.floater.left += percent; 
                 lastScrollX = lastScrollX + percent; 
           }       
     } 
     <!-- /STALKER CODE --> 
     <!-- DRAG DROP CODE --> 
     if(NS || IE) action = window.setInterval("heartBeat()",1); 
          </SCRIPT> 
      <table width="102" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
          <td><img src="Inc/Menu/Menu_r1_c1.png" width="102" height="43"></td> 
        </tr> 
        <tr> 
          <td><a href="Flow.asp"><img src="Inc/Menu/Menu_r2_c1.png" width="102" height="74" border="0"></a></td> 
        </tr> 
        <tr> 
          <td><a href="Factory.asp"><img src="Inc/Menu/Menu_r3_c1.png" width="102" height="80" border="0"></a></td> 
        </tr> 
        <tr> 
          <td><a href="Paper.asp"><img src="Inc/Menu/Menu_r4_c1.png" width="102" height="104" border="0"></a></td> 
        </tr> 
      </table> 
    </DIV>  
  
页面自动跳转

在<head>和</head>之间加入这句就可以了:<meta HTTP-EQUIV=REFRESH CONTENT="0;URL=http://www.218ts.com"> 
CONTENT后面的0表示秒数,URL后面可以是相对路径文件名,也可以是http的绝对路径。 
这种方法属于客户端的跳转。  
  
  
图片切换

<script language=JavaScript> 
<!-- // BannerAD

   var bannerAD=new Array(); 
   var bannerADlink=new Array(); 
   var adNum=0;

   bannerAD[0]="001.JPG"; 
   bannerADlink[0]="#"; 
   bannerAD[1]="002.JPG"; 
   bannerADlink[1]="#"; 
   bannerAD[2]="003.JPG"; 
   bannerADlink[2]="#"; 
    
   bannerAD[3]="004.JPG"; 
   bannerADlink[3]="#"; 
   bannerAD[4]="005.JPG"; 
   bannerADlink[4]="#"; 
   bannerAD[5]="006.jPG"; 
   bannerADlink[5]="#"; 
    
   bannerAD[6]="007.JPG"; 
   bannerADlink[6]="#"; 
   bannerAD[7]="008.JPG"; 
   bannerADlink[7]="#"; 
   bannerAD[8]="009.jPG"; 
   bannerADlink[8]="#"; 
    
   bannerAD[9]="010.JPG"; 
   bannerADlink[9]="#"; 
   bannerAD[10]="011.JPG"; 
   bannerADlink[10]="#"; 
    
    
   var preloadedimages=new Array(); 
   for (i=1;i<bannerAD.length;i++){ 
      preloadedimages=new Image(); 
      preloadedimages.src=bannerAD; 
   }

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++ ; 
      else adNum=0; 
   setTransition(); 
   document.images.bannerADrotator.src=bannerAD[adNum]; 
   playTransition(); 
   theTimer=setTimeout("nextAd()", 6000); 
}

function jump2url(){ 
   jumpUrl=bannerADlink[adNum]; 
   jumpTarget='_blank'; 
   if (jumpUrl != ''){ 
      if (jumpTarget != '')window.open(jumpUrl,jumpTarget); 
      else location.href=jumpUrl; 
   } 
} 
function displayStatusMsg() {  
   status=bannerADlink[adNum]; 
   document.returnValue = true; 
}

//--> 
</script>

                               
 

 
引用: 
<A onmouseover="displayStatusMsg();return document.returnValue"  
      href="javascript:jump2url()"><img  
      style="FILTER: revealTrans(duration=2,transition=20)" height=100  
      src="002.jpg" width=200 
        border=0  
      name=bannerADrotator> </A>  
                  <SCRIPT language=JavaScript>nextAd()</SCRIPT>  
  
  
一段超级好的..漂浮广告代码..精一下..

<SCRIPT>  
var imagepath="http://www.mmblue.com/ad/ad.jpg";    //图片路径 
var imagewidth=171 //这两行写图片的大小  
var imageheight=133  
var speed=3;  
var imageclick="http://www.mmblue.com/"; //这里写点击图片连接到的地址  
var hideafter=0  
var isie=0;  
if(window.navigator.appName=="Microsoft Internet Explorer"&&window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE")+5,window.navigator.appVersion.indexOf("MSIE")+8)>=5.5) {  
isie=1;  
}  
else {  
isie=0;  
}  
if(isie){  
var preloadit=new Image()  
preloadit.src=imagepath  
}  
function pop() {  
if(isie) {  
x=x+dx;y=y+dy;  
oPopup.show(x, y, imagewidth, imageheight);  
if(x+imagewidth+5>screen.width) dx=-dx;  
if(y+imageheight+5>screen.height) dy=-dy;  
if(x<0) dx=-dx;  
if(y<0) dy=-dy;  
startani=setTimeout("pop();",50);  
}  
}  
function dismisspopup(){  
clearTimeout(startani)  
oPopup.hide()  
}  
function dowhat(){  
if (imageclick=="dismiss")  
dismisspopup()  
else  
window.open(imageclick);  
}  
if(isie) {  
var x=0,y=0,dx=speed,dy=speed;  
var oPopup = window.createPopup();  
var oPopupBody = oPopup.document.body;  
oPopupBody.style.cursor="hand"  
oPopupBody.innerHTML = '<IMG SRC="'+preloadit.src+'">';  
oPopup.document.body.onmouseover=new Function("clearTimeout(startani)")  
oPopup.document.body.onmouseout=pop  
oPopup.document.body.onclick=dowhat  
pop();  
if (hideafter>0)  
setTimeout("dismisspopup()",hideafter*1000)  
}  
</SCRIPT>  
  
鼠标移动到图片上图片渐显效果

 

           ◆在<head>到</head>之间插入如下的JAVASCRIPT代码: 
<script> 
nereidFadeObjects = new Object(); 
nereidFadeTimers = new Object(); 
function nereidFade(object, destOp, rate, delta){ 
if (!document.all) 
return 
if (object != "[object]"){  
setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0); 
return; 
} 
clearTimeout(nereidFadeTimers[object.sourceIndex]); 
diff = destOp-object.filters.alpha.opacity; 
direction = 1; 
if (object.filters.alpha.opacity > destOp){ 
direction = -1; 
} 
delta=Math.min(direction*diff,delta); 
object.filters.alpha.opacity+=direction*delta; 
if (object.filters.alpha.opacity != destOp){ 
nereidFadeObjects[object.sourceIndex]=object; 
nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate); 
} 
} 
</script>  
在要插入的图片添加如下代码: 
<img onMouseOut=nereidFade(this,50,10,4) onMouseOver=nereidFade(this,100,10,4) style="FILTER: alpha(opacity=50)" src="图片名">

*其中onMouseOver=nereidFade(this,50,10,4)中 style="FILTER: alpha(opacity=50)"表示图片的透明度为50% 

 

Meta用法

1、Content-Type和Content-Language (显示字符集的设定)  
说明:设定页面使用的字符集,用以说明主页制作所使用的文字已经语言,浏览器会根据此来调用相应的字符集显示page内容。  
用法:<Meta http-equiv="Content-Type" Content="text/html; Charset=gb2312">  
   <Meta http-equiv="Content-Language" Content="zh-CN">  
注意:该META标签定义了HTML页面所使用的字符集为GB2132,就是国标汉字码。如果将其中的“charset=GB2312”替换成 “BIG5”,则该页面所用的字符集就是繁体中文Big5码。当你浏览一些国外的站点时,IE浏览器会提示你要正确显示该页面需要下载xx语支持。这个功能就是通过读取HTML页面META标签的Content-Type属性而得知需要使用哪种字符集显示该页面的。如果系统里没有装相应的字符集,则IE就提示下载。其他的语言也对应不同的charset,比如日文的字符集是“iso-2022-jp ”,韩文的是“ks_c_5601”。  
        
Content-Type的Content还可以是:text/xml等文档类型;  
Charset选项:ISO-8859-1、BIG5、UTF-8、SHIFT-Jis、Euc、Koi8-2、us-ascii,   
x-mac-roman, iso-8859-2, x-mac-ce, iso-2022-jp, x-sjis, x-euc-jp,  
euc-kr, iso-2022-kr, gb2312, gb_2312-80, x-euc-tw, x-cns11643-1, x-cns11643-2等字符集;  
Content-Language的Content还可以是:EN、FR等语言代码。

2、Refresh (刷新)  
说明:让网页多长时间(秒)刷新自己,或在多长时间后让网页自动链接到其它网页。  
用法:<Meta http-equiv="Refresh" Content="30">  
   <Meta http-equiv="Refresh" Content="5; Url=http://www.xia8.net">  
注意:其中的5是指停留5秒钟后自动刷新到URL网址。

3、Expires (期限)  
说明:指定网页在缓存中的过期时间,一旦网页过期,必须到服务器上重新调阅。  
用法:<Meta http-equiv="Expires" Content="0">  
   <Meta http-equiv="Expires" Content="Wed, 26 Feb 1997 08:21:57 GMT">  
注意:必须使用GMT的时间格式,或直接设为0(数字表示多少时间后过期)。

4、Pragma (cach模式)  
说明:禁止浏览器从本地机的缓存中调阅页面内容。  
用法:<Meta http-equiv="Pragma" Content="No-cach">  
注意:这样设定,访问者将无法脱机浏览。

5、Set-Cookie (cookie设定)  
说明:浏览器访问某个页面时会将它存在缓存中,下次再次访问时就可从缓存中读取,以提高速度。当你希望访问者每次都刷新你广告的图标,或每次都刷新你的计数器,就要禁用缓存了。通常HTML文件没有必要禁用缓存,对于ASP等页面,就可以使用禁用缓存,因为每次看到的页面都是在服务器动态生成的,缓存就失去意义。如果网页过期,那么存盘的cookie将被删除。  
用法:<Meta http-equiv="Set-Cookie" Content="cookievalue=xxx; expires=Wednesday, 21-Oct-98 16:14:21 GMT; path=/">  
注意:必须使用GMT的时间格式。

6、Window-target (显示窗口的设定)  
说明:强制页面在当前窗口以独立页面显示。  
用法:<Meta http-equiv="Widow-target" Content="_top">  
注意:这个属性是用来防止别人在框架里调用你的页面。Content选项:_blank、_top、_self、_parent。

7、Pics-label (网页RSAC等级评定)  
说明:在IE的Internet选项中有一项内容设置,可以防止浏览一些受限制的网站,而网站的限制级别就是通过该参数来设置的。  
用法:<META http-equiv="Pics-label" Contect="(PICS-1.1'http://www.rsac.org/ratingsv01.html'  
I gen comment 'RSACi North America Sever' by 'inet@microsoft.com' for 'http://www. microsoft.com' on '1997.06.30T14:21-0500' r(n0 s0 v0 l0))">  
注意:不要将级别设置的太高。RSAC的评估系统提供了一种用来评价Web站点内容的标准。用户可以设置Microsoft Internet Explorer(IE3.0以上)来排除包含有色情和暴力内容的站点。上面这个例子中的HTML取自Microsoft的主页。代码中的(n 0 s 0 v 0 l 0)表示该站点不包含不健康内容。级别的评定是由RSAC,即美国娱乐委员会的评级机构评定的,如果你想进一步了解RSAC评估系统的等级内容,或者你需要评价自己的网站,可以访问RSAC的站点:http://www.rsac.org/ 
               
8、Page-Enter、Page-Exit (进入与退出)  
说明:这个是页面被载入和调出时的一些特效。  
用法:<Meta http-equiv="Page-Enter" Content="blendTrans(Duration=0.5)">  
   <Meta http-equiv="Page-Exit" Content="blendTrans(Duration=0.5)">  
注意:blendTrans是动态滤镜的一种,产生渐隐效果。另一种动态滤镜RevealTrans也可以用于页面进入与退出效果:  
               
      <Meta http-equiv="Page-Enter" Content="revealTrans(duration=x, transition=y)">  
      <Meta http-equiv="Page-Exit" Content="revealTrans(duration=x, transition=y)">

       Duration  表示滤镜特效的持续时间(单位:秒)  
       Transition 滤镜类型。表示使用哪种特效,取值为0-23。  
               
       0 矩形缩小  
       1 矩形扩大  
       2 圆形缩小  
       3 圆形扩大  
       4 下到上刷新  
       5 上到下刷新  
       6 左到右刷新  
       7 右到左刷新  
       8 竖百叶窗  
       9 横百叶窗  
       10 错位横百叶窗  
       11 错位竖百叶窗  
       12 点扩散  
       13 左右到中间刷新  
       14 中间到左右刷新  
       15 中间到上下  
       16 上下到中间  
       17 右下到左上  
       18 右上到左下  
       19 左上到右下  
       20 左下到右上  
       21 横条  
       22 竖条  
       23 以上22种随机选择一种

  9、MSThemeCompatible (XP主题)  
   说明:是否在IE中关闭 xp 的主题  
   用法:<Meta http-equiv="MSThemeCompatible" Content="Yes">  
   注意:关闭 xp 的蓝色立体按钮系统显示样式,从而和win2k 很象。

  10、IE6 (页面生成器)  
   说明:页面生成器generator,是ie6  
   用法:<Meta http-equiv="IE6" Content="Generator">  
   注意:用什么东西做的,类似商品出厂厂商。

  11、Content-Script-Type (脚本相关)  
   说明:这是近来W3C的规范,指明页面中脚本的类型。  
   用法:<Meta http-equiv="Content-Script-Type" Content="text/javascript"> 
  
网页代码4                                      

 两侧随页面滚动代码,可以去掉一边 
新建一个JS文件drop.js,代码如下: 
  //常数定义  
self.onError=null;     
currentX = currentY = 0;     
whichIt = null;     
lastScrollX = 0; //最后离左边距离的负值 
lastScrollY =0;  //最后离顶部的高度的负值 
   
//----------------------start fun秒执行一次    
function heartBeat(id1,id2) {     
diffY = document.body.scrollTop; 
diffX = document.body.scrollLeft;

if(diffY != lastScrollY) {     
percent = .1 * (diffY - lastScrollY);     
if(percent > 0) percent = Math.ceil(percent);     
else percent = Math.floor(percent);     
id1.style.pixelTop += percent; 
id2.style.pixelTop += percent;    
lastScrollY = lastScrollY + percent;     
}   

if(diffX != lastScrollX) {     
percent = .1 * (diffX - lastScrollX);     
if(percent > 0) percent = Math.ceil(percent);     
else percent = Math.floor(percent);     
id1.style.pixelTop += percent; 
id2.style.pixelTop += percent;       
lastScrollX = lastScrollX + percent;     
}     
}     
//-----------------------end fun 
scr=screen.width 
left_1=(scr>800)?10:145 
right_1=(scr>800)?880:580

//左侧图片 
document.write("<DIV id=f1 style='left: "+left_1+"px; top: 215px; POSITION: absolute;'><a href=链接地址 target=_blank><img src=图片地址 border=0 width=120 height=125></a></div>")

//右侧图片 
document.write("<DIV id=f2 style='left: "+right_1+"px; top: 215px; POSITION: absolute;'><a href=链接地址 target=_blank><img src=图片地址 border=0 width=150 height=47></a></div>")

action = window.setInterval("heartBeat(f1,f2)",50);   

然后在你想要放的页面上加上这段代码

<script src="drop.js"></script>


原创文章如转载,请注明:转载自滨江区电脑维修_杭州电脑保姆 [ http://yzw.blog.zj.com/ ]
本文链接地址:http://yzw.blog.zj.com/blog/d-167739.html

相关文章
文章评论0条回复
给文章评分
评分: -5 -3 -1 - +1 +3 +5
我来说两句
认证码* 看不清,就点我! 输入四位字母或数字
(您还没有登录,登录发表)
粗体 斜体 下划线 插入url链接 飞行字 移动字