禁止頁面正文選取
<body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"onmouseup="document.selection.empty()">
消除ie6自動出現的圖像工具欄,設置 GALLERYIMG屬性為false或no .
<IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="no">
防止點擊空鏈接時,頁面往往重置到頁首端。
代碼“javascript:void(null)”代替原來的“#”標記
如何避免別人把你的網頁放在框架中
<script language=“javascript”><!--if (self!=top){top.location=self.location;} -->< /script>
頁面定時刷新
<meta http-equiv="Refresh" content="秒" >
頁面定時轉向新的地址
<meta http-equiv="refresh" content="秒;URL=url">
顯示日期
<script language="javascript"><!--
today=new Date();
var week; var date;
if(today.getDay()==0) week="星期日"
if(today.getDay()==1) week="星期一"
if(today.getDay()==2) week="星期二"
if(today.getDay()==3) week="星期三"
if(today.getDay()==4) week="星期四"
if(today.getDay()==5) week="星期五"
if(today.getDay()==6) week="星期六"
date=(today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日"+" "
document.write("<span style='font-size: 9pt;'>"+date+week+"</span>");
// -->
</script>
設為首頁
<A href=# onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('url');">設為首頁</A>
添加收藏
<A href="javascript:window.external.AddFavorite('url','title')"> 加入收藏夾</A>
你謝我阿?難得哦~~我也有關閉窗口,這個是不會彈出提示直接關的:
把如下代碼加入<body>區域中
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
<script language="javascript">function shutwin(){closes.Click();return;}</script>
<a href="javascript:shutwin();">關閉本窗口</a>
隨機圖片:
把如下代碼加入<body>區域中
<script language="javascript"><!--
today=new Date();
jran=today.getTime();
function rnd() {
ia=9301;
ic=49297;
im=233280;
jran = (jran*ia+ic) % im;
return jran/(im*1.0);
};
function rand(number) {
return Math.ceil(rnd()*number);
};
document.write("<CENTER>");
for(i=1;i<=1;i++) {
myNum=(rand(10)); //改成你要隨機顯示的圖片數;
if(myNum == 1) document.write("<img src='photo/back.jpg'>");
if(myNum == 2) document.write("<img src='photo/j2.gif'>"); //圖片路徑,可用http:// ;
if(myNum == 3) document.write("<img src='photo/email.gif'>");
if(myNum == 4) document.write("<img src='photo/arrow.gif'>");
if(myNum == 5) document.write("<img src='photo/j2.gif'>");
if(myNum == 6) document.write("<img src='photo/email.gif'>");
if(myNum == 7) document.write("<img src='photo/arrow.gif'>");
if(myNum == 8) document.write("<img src='photo/j2.gif'>");
if(myNum == 9) document.write("<img src='photo/back.jpg'>");
if(myNum == 10) document.write("<img src='photo/email.gif'>");
else {
document.write();
}
};
document.write("</CENTER>");
//-->
</script>
其實改一改隨機什么都行,也不一定在body中
圖片顯隱效果
腳本說明:
把如下代碼加入<body>區域中
<script language=javascript>
// Flash Image Extension for Dreamwever ,by Yichun Yuan(dezone@sina.com)
nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
if (object != "[object]"){ //do this so I can take a string too
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>
<a href=#><img src="photoshopcn.jpg" border=0 onMouseOut=nereidFade(this,50,10,5) onMouseOver=nereidFade(this,100,10,5) style="FILTER: alpha(opacity=40)"></a>
<body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"onmouseup="document.selection.empty()">
消除ie6自動出現的圖像工具欄,設置 GALLERYIMG屬性為false或no .
<IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="no">
防止點擊空鏈接時,頁面往往重置到頁首端。
代碼“javascript:void(null)”代替原來的“#”標記
如何避免別人把你的網頁放在框架中
<script language=“javascript”><!--if (self!=top){top.location=self.location;} -->< /script>
頁面定時刷新
<meta http-equiv="Refresh" content="秒" >
頁面定時轉向新的地址
<meta http-equiv="refresh" content="秒;URL=url">
顯示日期
<script language="javascript"><!--
today=new Date();
var week; var date;
if(today.getDay()==0) week="星期日"
if(today.getDay()==1) week="星期一"
if(today.getDay()==2) week="星期二"
if(today.getDay()==3) week="星期三"
if(today.getDay()==4) week="星期四"
if(today.getDay()==5) week="星期五"
if(today.getDay()==6) week="星期六"
date=(today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日"+" "
document.write("<span style='font-size: 9pt;'>"+date+week+"</span>");
// -->
</script>
設為首頁
<A href=# onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('url');">設為首頁</A>
添加收藏
<A href="javascript:window.external.AddFavorite('url','title')"> 加入收藏夾</A>
你謝我阿?難得哦~~我也有關閉窗口,這個是不會彈出提示直接關的:
把如下代碼加入<body>區域中
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
<script language="javascript">function shutwin(){closes.Click();return;}</script>
<a href="javascript:shutwin();">關閉本窗口</a>
隨機圖片:
把如下代碼加入<body>區域中
<script language="javascript"><!--
today=new Date();
jran=today.getTime();
function rnd() {
ia=9301;
ic=49297;
im=233280;
jran = (jran*ia+ic) % im;
return jran/(im*1.0);
};
function rand(number) {
return Math.ceil(rnd()*number);
};
document.write("<CENTER>");
for(i=1;i<=1;i++) {
myNum=(rand(10)); //改成你要隨機顯示的圖片數;
if(myNum == 1) document.write("<img src='photo/back.jpg'>");
if(myNum == 2) document.write("<img src='photo/j2.gif'>"); //圖片路徑,可用http:// ;
if(myNum == 3) document.write("<img src='photo/email.gif'>");
if(myNum == 4) document.write("<img src='photo/arrow.gif'>");
if(myNum == 5) document.write("<img src='photo/j2.gif'>");
if(myNum == 6) document.write("<img src='photo/email.gif'>");
if(myNum == 7) document.write("<img src='photo/arrow.gif'>");
if(myNum == 8) document.write("<img src='photo/j2.gif'>");
if(myNum == 9) document.write("<img src='photo/back.jpg'>");
if(myNum == 10) document.write("<img src='photo/email.gif'>");
else {
document.write();
}
};
document.write("</CENTER>");
//-->
</script>
其實改一改隨機什么都行,也不一定在body中
圖片顯隱效果
腳本說明:
把如下代碼加入<body>區域中
<script language=javascript>
// Flash Image Extension for Dreamwever ,by Yichun Yuan(dezone@sina.com)
nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
if (object != "[object]"){ //do this so I can take a string too
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>
<a href=#><img src="photoshopcn.jpg" border=0 onMouseOut=nereidFade(this,50,10,5) onMouseOver=nereidFade(this,100,10,5) style="FILTER: alpha(opacity=40)"></a>
标签:一些好的代碼
推薦設計
優秀海報設計精選集(8)海報設計2022-09-23
充滿自然光線!32平米精致裝修設計2022-08-14
親愛的圖書館 | VERSE雜誌版版式設計2022-07-11
生活,就該這麼愛!2022天海報設計2022-06-02
最新文章
最后加載廣告的JS代碼其他教程2012-05-23
網頁設計的標準尺寸其他教程2008-03-03
如何讓廣告代碼不影響網其他教程2007-12-11
網頁設計基礎:文字大小的其他教程2007-10-11