JavaScript經(jīng)典效果集錦
些很實(shí)用且必用的小腳本代碼:
腳本1:進(jìn)入主頁以后自動(dòng)播放聲音
腳本2:進(jìn)入主頁后自動(dòng)最大話,省的去在自己單擊了
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
腳本3:顯示現(xiàn)在時(shí)間的腳本
document.writenow
腳本4:顯示最后修改時(shí)間的腳本
document.write(document.lastModified)
腳本5:設(shè)為首頁,加為收藏,加入頻道,啟動(dòng)outlook發(fā)信
<astyle="cursor:hand"
onclick="this.style.behavior="url(#default#homepage)";
this.setHomePage("yourURL">設(shè)為首頁
<astyle="cursor:hand"
onclick="window.external.AddFavorite(location.href,document.title);">加入收藏
加入頻道
與我聯(lián)系
腳本6:狀態(tài)欄動(dòng)態(tài)顯示現(xiàn)在時(shí)間
functionsee(){
window.setTimeout("see()",1000);
today=newDate();
self.status=today.toString();
}
腳本7:關(guān)閉窗口的腳本
[關(guān)閉窗口]
腳本8:按下F12鍵,直接返回首頁
functionlook(){ if(event.keyCode==123){document.location.href=http://10.13.31.90/~kayvin/} } if(document.onkeydown==null) {document.onkeydown=look}
腳本9:后退,刷新,前進(jìn)
復(fù)制代碼 代碼如下:
腳本10:設(shè)定時(shí)間彈出窗口,4000=4秒,當(dāng)然你可以自定義
復(fù)制代碼 代碼如下:
functionl(){ window.open("yourURL","name","width=500,height=150,border=0") } setTimeout("l()",4000)
二鼠標(biāo)旁邊的提示信息,類似與163登錄后的頁面提示效果
tip //***********默認(rèn)設(shè)置定義.********************* tPopWait=50;//停留tWait豪秒后顯示提示。 tPopShow=5000;//顯示tShow豪秒后關(guān)閉提示 showPopStep=20; popOpacity=99; //***************內(nèi)部變量定義***************** sPop=null; curShow=null; tFadeOut=null; tFadeIn=null; tFadeWaiting=null; document.write(""); 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)}"); document.write(""); document.write(""); function showPopupText(){ var o=event.srcElement; MouseX=event.x; MouseY=event.y; if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""}; if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""}; if(o.dypop!=sPop) { sPop=o.dypop; clearTimeout(curShow); clearTimeout(tFadeOut); clearTimeout(tFadeIn); clearTimeout(tFadeWaiting); if(sPop==null || sPop=="") { dypopLayer.innerHTML=""; dypopLayer.style.filter="Alpha()"; dypopLayer.filters.Alpha.opacity=0; } else { if(o.dyclass!=null) popStyle=o.dyclass else popStyle="cPopText"; curShow=setTimeout("showIt()",tPopWait); } } } function showIt(){ dypopLayer.className=popStyle; dypopLayer.innerHTML=sPop; popWidth=dypopLayer.clientWidth; popHeight=dypopLayer.clientHeight; if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24 else popLeftAdjust=0; if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24 else popTopAdjust=0; dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust; dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust; dypopLayer.style.filter="Alpha(Opacity=0)"; fadeOut(); } function fadeOut(){ if(dypopLayer.filters.Alpha.opacity0) { dypopLayer.filters.Alpha.opacity-=1; tFadeIn=setTimeout("fadeIn()",1); } } document.onmouseover=showPopupText;
[Ctrl+A 全選 注:如需引入外部Js需刷新才能執(zhí)行]
【JavaScript經(jīng)典效果】相關(guān)文章:
有關(guān)javascript實(shí)現(xiàn)的多個(gè)層切換效果通用函數(shù)示例10-07
對javascript的理解08-08
常用的JavaScript模式09-22
Javascript的this用法簡述08-15
JavaScript 基礎(chǔ)教學(xué)09-29
JavaScript的課堂講解09-03
JavaScript常用方法匯總10-25