html缓存特效代码,HTML特效代码
1。忽視右鍵
或
2。加入背景音樂
IE:
NS:
*.mid你的背景音樂的midi格式文件
3。簡單的window.open方法
:window.open(文件路徑/文件名,newwindow,
toolbar=no,scrollbars=yes,resizable=no,top=0,left=0,
width=400,height=300);">文字或圖片
參數(shù)解釋:
window.open 彈出新窗口的命令;
文件路徑/文件名 彈出窗口的文件名;
newwindow 彈出窗口的名字(不是文件名),非必須,可用空代替;
width=400 窗口寬度;
height=300 窗口高度;
top=0 窗口距離屏幕上方的象素值;
left=0 窗口距離屏幕左側(cè)的象素值;
toolbar=no 是否顯示工具欄,yes為顯示;
menubar,scrollbars 表示菜單欄和滾動欄。
resizable=no 是否允許改變窗口大小,yes為允許;
location=no 是否顯示地址欄,yes為允許;
status=no 是否顯示狀態(tài)欄內(nèi)的信息(通常是文件已經(jīng)打開),yes為允許;
js腳本結(jié)束
4。簡單的頁面加密
5。拉動頁面時背景圖不動
body{background-p_w_picpath:url(logo.gif);
background-repeat:no-repeat;background-position:center}
6。讓瀏覽器在保存頁面時保存失敗
7。隨機替換圖片
document.write(
圖片文件名為0.gif 1.gif 2.gif 3.gif 4.gif
8。窗口定時關(guān)閉
先將如下代碼網(wǎng)頁文件的區(qū):
function closeit() { setTimeout("self.close()",10000) //毫秒 }
然后再在
標內(nèi)加入如:9。網(wǎng)頁自動關(guān)閉
classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
這個窗口會在10秒過后自動關(guān)閉,而且不會出現(xiàn)提示.
10。網(wǎng)頁自動刷新
在head部記入
其中20為20秒后自動刷新,你可以更改為任意值。
11。網(wǎng)頁自動轉(zhuǎn)頁
12。保持layer在最前面,而不被Iframe、Object所覆蓋
在Layer中再插Iframe 或 Object 設(shè)z-Index值
# 前面# 后面height=100% width=100%>13。返回上一頁
『返回上一頁』
14。關(guān)閉窗口
『關(guān)閉窗口』
15。關(guān)于iframe的透明背景
allowTransparency="true"
style="background-color: green">
16. οncοntextmenu="window.event.returnValue=false" 將徹底屏蔽鼠標右鍵
可用于Table17.
取消選取、防止復(fù)制18.οnpaste="return false" 不準粘貼
19.οncοpy="return false;" oncut="return false;" 防止復(fù)制
20. IE地址欄前換成自己的圖標
21. 可以在收藏夾中顯示出你的圖標
22. 關(guān)閉輸入法
23. 永遠都會帶著框架
if (window == top)top.location.href = "frames.htm"; //frames.htm為框架網(wǎng)頁
// -->
24. 防止被人frame
if (top.location != self.location)top.location=self.location;
// -->
25. 網(wǎng)頁將不能被另存為
26. 查看網(wǎng)頁源代碼
27.刪除時確認
刪除
28.屏蔽功能鍵Shift,Alt,Ctrl
function look(){
if(event.shiftKey)
alert("禁止按Shift鍵!"); //可以換成ALT CTRL
}
document.οnkeydοwn=look;
29. 網(wǎng)頁不會被緩存
或者
30.怎樣讓表單沒有凹凸感?
或
31.不要滾動條?
讓豎條沒有:
讓橫條沒有:
兩個都去掉?更簡單了
32.怎樣去掉圖片鏈接點擊后,圖片周圍的虛線?
33.電子郵件處理提交表單
34.在打開的子窗口刷新父窗口的代碼里如何寫?
window.opener.location.reload()
35.如何設(shè)定打開頁面的大小
打開頁面的位置
36.在頁面中如何加入不是滿鋪的背景圖片,拉動頁面時背景圖不動
body
{background-p_w_picpath:url(logo.gif); background-repeat:no-repeat;
background-position:center;background-p_w_upload: fixed}
37. 檢查一段字符串是否全由數(shù)字組成
function checkNum(str){return str.match(//D/)==null}
alert(checkNum("1232142141"))
alert(checkNum("123214214a1"))
// -->
38. 獲得一個窗口的大小
document.body.clientWidth; document.body.clientHeight
39. 怎么判斷是否是字符
if (/[^/x00-/xff]/g.test(s)) alert("含有漢字");
else alert("全是字符");
40.TEXTAREA自適應(yīng)文字行數(shù)的多少
41. 日期減去天數(shù)等于第二個日期
function cc(dd,dadd)
{
//可以加上錯誤處理
var a = new Date(dd)
a = a.valueOf()
a = a - dadd * 24 * 60 * 60 * 1000
a = new Date(a)
alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日")
} cc("12/23/2002",2)
42. 選擇了哪一個Radio
function checkme()
for each ob in radio1
if ob.checked then window.alert ob.value
next
end function
Style
Barcode
43.腳本永不出錯
44.ENTER鍵可以讓光標移到下一個輸入框
45. 檢測某個網(wǎng)站的鏈接速度:
把如下代碼加入
區(qū)域中:tim=1
setInterval("tim++",100)
b=1
var autourl=new Array()
autourl[1]="www.njcatv.net"
autourl[2]="javacool.3322.net"
autourl[3]="www.sina.com.cn"
autourl[4]="www.nuaa.edu.cn"
autourl[5]="www.cctv.com"
function butt(){
document.write("
")for(var i=1;i
document.write("
……> =》
name=url"+i+" size=40> =》
οnclick=window.open(this.form.url"+i+".value)>
")
document.write("
")}
butt()
function auto(url){
document.forms[0]["url"+b].value=url
if(tim>200)
{document.forms[0]["txt"+b].value="鏈接超時"}
else
{document.forms[0]["txt"+b].value="時間"+tim/10+"秒"} b++ }
function run(){for(var i=1;i")}
run()
46. 各種樣式的光標
auto :標準光標
default :標準箭頭
hand :手形光標
wait :等待光標
text :I形光標
vertical-text :水平I形光標
no-drop :不可拖動光標
not-allowed :無效光標
help :?幫助光標
all-scroll :三角方向標
move :移動標
crosshair :十字標
e-resize
n-resize
nw-resize
w-resize
s-resize
se-resize
sw-resize
47、禁止鼠標右鍵,把Demo的圖片全都設(shè)為表格的背景,表格的大小與圖片的大小一樣。這樣做看起來是一樣的,主要是防止鼠標經(jīng)過圖片時會出現(xiàn)另存的按鈕。禁止鼠標右鍵的代碼很簡單:
function click() { if (event.button==2)
{alert(呵呵,不好意思,你甭想使用右鍵下載圖片:)); } } document.οnmοusedοwn=click
48、在網(wǎng)頁的Head部分加入如下代碼,這段代碼的主要功能是屏蔽PrintScreen鍵,不斷清空剪貼版,防止圖片被用文件——另存為菜單另存。
總結(jié)
以上是生活随笔為你收集整理的html缓存特效代码,HTML特效代码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 日历下面备注,怎样在日历
- 下一篇: html5+调用safari,Safar