一、一些很实用且必用的小脚本代码:
脚本1:进入主页以后自动播放声音
<embed src=”pnm://10.13.31.90/~kayvin/mihunji.rm” hidden=true autostart=true loop=true>
脚本2:进入主页后自动最大话,省的去在自己单击了
| 以下为引用的内容: <script> self.moveTo(0,0) self.resizeTo(screen.availWidth,screen.availHeight) </script> |
脚本3:显示现在时间的脚本
<script language=vbscript>document.write now</script>
脚本4:显示最后修改时间的脚本
<script>document.write(document.lastModified)</script>
脚本5:设为首页,加为收藏,加入频道,启动outlook发信
| 以下为引用的内容: <a style=”cursor:hand” onclick=”this.style.behavior=”url(#default#homepage)”; this.setHomePage(http://10.13.31.90/~kayvin/);”>”>设为首页</a> <a style=”cursor:hand” <a href=javascript:window.external.addChannel(”typhoon.cdf”)>加入频道</a> <a href=”mailtkayvin@sohu.com“>与我联系</a> |
脚本6:状态栏动态显示现在时间
| 以下为引用的内容: <script> function see(){ window.setTimeout(”see()”,1000); today = new Date(); self.status = today.toString(); } </script> <body onload=see()> |
脚本7:关闭窗口的脚本
<a href=javascript:close()>[关闭窗口]</a> 中国站.长站
脚本8:按下F12键,直接返回首页
| 以下为引用的内容: <script>function look(){ if(event.keyCode==123){document.location.href=http://10.13.31.90/~kayvin/} } if(document.onkeydown==null) {document.onkeydown=look} </script> |
脚本9:后退,刷新,前进
| 以下为引用的内容: <input type=button value=后退 onclick=history.go(-1)>Www.Chinaz.com <input type=button value=刷新 onclick=history.go(-0)> 中国站长_站,为中文网站提供动力 <input type=button value=前进 onclick=history.go(+1)> 中国.站长站 |
脚本10:设定时间弹出窗口,4000=4秒,当然你可以自定义
| 以下为引用的内容: <script>function l() { window.open(” 10.13.31.90/~kayvin/ “,”name”,”width=500,height=150,border=0″) } setTimeout(”l()”,4000) </script> Www@Chinaz@com |
脚本11:鼠标旁边的提示信息,类似与163登录后的页面提示效果
| 以下为引用的内容: <a href=”#” title=”这是提示”>tip</a> <script Language=”JavaScript”> //***********默认设置定义.********************* tPopWait=50;//停留tWait豪秒后显示提示。 tPopShow=5000;//显示tShow豪秒后关闭提示 showPopStep=20; popOpacity=99; //***************内部变量定义***************** sPop=null; curShow=null; tFadeOut=null; tFadeIn=null; tFadeWaiting=null; document.write(”<style type=’text/css’id=’defaultPopStyle’>”); document.write(”.cPopText { background-color: #F8F8F5;color:#000000; border: 1px #000000 solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}”); if(sPop==null || sPop==”") { |
脚本12:如果文字过长,则将过长的部分变成省略号显示
| 以下为引用的内容: <DIV STYLE=”width: 120px; height: 50px; border: 1px solid blue; overflow: hidden; text-overflow:ellipsis”> <NOBR>就是比如有一行文字,很长,表格内一行显示不下.</NOBR> </DIV> |
脚本13:滚动的图片
| 以下为引用的内容: <script language=”javascript”> imgArr=new Array() imgArr[0]=”<a href=# onmouseMove=’javascript:outHover=true’ onMouseover=’javascript:outHover=true’ onMouseout=’javascript:outHover=false;mvStart()’><img src=http://mc.mapabc.com/mapcard/images/LP_card_1.gif border=0></a>” imgArr[1]=”<a href=# onmouseMove=’javascript:outHover=true’ onMouseover=’javascript:outHover=true’ onMouseout=’javascript:outHover=false;mvStart()’><img src=http://mc.mapabc.com/mapcard/images/LP_card_1.gif border=0></a>” imgArr[2]=”<a href=# onmouseMove=’javascript:outHover=true’ onMouseover=’javascript:outHover=true’ onMouseout=’javascript:outHover=false;mvStart()’><img src=http://mc.mapabc.com/mapcard/images/LP_card_1.gif border=0></a>” imgArr[3]=”<a href=# onmouseMove=’javascript:outHover=true’ onMouseover=’javascript:outHover=true’ onMouseout=’javascript:outHover=false;mvStart()’><img src=http://mc.mapabc.com/mapcard/images/LP_card_1.gif border=0></a>” nextDivClipRight=parseInt(eval(”document.divOuter.document.divAds”+nextDnum+”.clip.right”)) eval(”document.divOuter.document.divAds”+startDnum+”.left=”+divWidth*displayImgAmount) startDnum=(++startDnum)%imgArr.length startDivClipLeft=moveStep-(divWidth-startDivClipLeft) startDivClipLeft=parseInt(eval(”document.all.divAds”+startDnum+”.currentStyle.clipLeft”)) Www@Chinaz@com if (startDivClipLeft+moveStep>divWidth){ eval(”document.all.divAds”+startDnum+”.style.left=”+divWidth*displayImgAmount) Chinaz@com startDnum=(++startDnum)%imgArr.length startDivClipLeft=moveStep-(divWidth-startDivClipLeft) eval(”document.all.divAds”+nextDnum+”.style.clip=’rect(0,”+nextDivClipRight+”,”+divHeight+”,0)’”) } for (i=0;i<imgArr.length;i++){ document.write(”</layer>”) for (i=0;i<imgArr.length;i++){ document.write(imgArr[i]+” “)
|
脚本14:接收键盘指令的脚本
按A就会跳转到地图名片的网页,请按A
| 以下为引用的内容: <SCRIPT language=”JavaScript”> <!– var hotkey=97 var destination=”http://mc.mapabc.com” if (document.layers) document.captureEvents(Event.KEYPRESS) function backhome(e){ if (document.layers){ if (e.which==hotkey) window.location=destination } else if (document.all){ if (event.keyCode==hotkey) window.location=destination } } document.onkeypress=backhome Chinaz_com onkeydown=”javascript:onenter();” Www~Chinaz~com function onenter(){ |
脚本15:让你的文本链接渐隐渐显 Chinaz
| 以下为引用的内容: <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME=”Generator” CONTENT=”EditPlus”> <META NAME=”Author” CONTENT=”"> <META NAME=”Keywords” CONTENT=”"> <META NAME=”Description” CONTENT=”"> </HEAD> <BODY> stepIn = 17; /* /* hexa = new makearray(16); document.onmouseover = domouseover; startColor = dehexize(startColor.toLowerCase()); var fadeId = new Array(); function dehexize(Color){ function domouseover() { function domouseout() { function makearray(n) { function hex(i) { Chinaz_com function setColor(r, g, b, element) { function fade(s,e, element,step){ if (fadeId[0] != null && fade[0] != element){ for(var i = 0; i <= step; i++) { } </BODY> |
脚本16:类似与QQ的好友/黑名单之类的树型菜单_极品
| 以下为引用的内容: <BODY> if (menu == null || actuator == null) return; //if (window.opera) return; // I’m too tired actuator.parentNode.style.backgroundImage = “url(/images/plus.gif)”; return false; #mainMenu { #menuList { li.menubar { .menu, .submenu { .menu li, .submenu li { a.actuator { a.actuator:hover { .menu li a, .submenu li a { .menu li a:hover, submenu li a:hover { span.key { |
脚本17:脚本翻页代码
| 以下为引用的内容: <!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> JavaScript: showPages v1.0 [by Lapuasi.com]</title> <script language=”JavaScript”> <!– /* 中国.站.长站showPages v1.1 ================================= Chinaz_comInfomation ———————- Author : Lapuasi E-Mail : lapuasi@gmail.com Web : http://www.lapuasi.com Date : 2005-11-17 [中国站长站] Example ———————- var pg = new showPages(’pg’); pg.pageCount = 12; //定义总页数(必要) pg.argName = ‘p’; //定义参数名(可选,缺省为page) pg.printHtml(); //显示页数 Supported in Internet Explorer, Mozilla Firefox */ Www~Chinaz~com function showPages(name) { //初始化属性 showPages.prototype.getPage = function(){ //丛url获得当前页数,如果变量重复只获取最后一个 if (i == this.page) { } if (this.page % 10 ==0) { if (nextPage > this.pageCount) { if (prevPage < 1) { } else { Chinaz.com strHtml += ‘<input type=”text” value=” / ‘ + this.pageCount + ‘” class=”icount” readonly=”readonly”>’; var reg = new RegExp(’([\?&]?)’ + this.argName + ‘=[^&]*[&$]?’, ‘gi’); Chinaz^com document.getElementById(’pages_’ + this.name + ‘_’ + this.showTimes).innerHTML = this.createHtml(mode); } Chinaz~com border-right: none; Chinaz@com } <body> Chinaz@com document.write(’<br>Show Times: ‘ + pg.showTimes + ‘, Mood Default’); |
本文汇总了一系列实用的网页小脚本代码,包括自动播放声音、显示当前时间、翻页功能等,适用于希望增强网站交互性和用户体验的开发者。

被折叠的 条评论
为什么被折叠?



