<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-200  評論-148  文章-15  trackbacks-0

    1. oncontextmenu="window.event.returnvalue=false" 將徹底屏蔽鼠標右鍵
    <table border oncontextmenu=return(false)><td>no</table> 可用于Table
    2. <body onselectstart="return false"> 取消選取、防止復(fù)制

    3. onpaste="return false" 不準粘貼

    4. oncopy="return false;" oncut="return false;" 防止復(fù)制

    5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址欄前換成自己的圖標

    6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夾中顯示出你的圖標

    7. <input style="ime-mode:disabled"> 關(guān)閉輸入法

    8. 永遠都會帶著框架
    <script language="javascript"><!--
    if (window == top)top.location.href = "frames.htm"; //frames.htm為框架網(wǎng)頁
    // --></script>

    9. 防止被人frame
    <SCRIPT LANGUAGE=javascript><!--
    if (top.location != self.location)top.location=self.location;
    // --></SCRIPT>

    10. <noscript><iframe src=*.html></iframe></noscript> 網(wǎng)頁將不能被另存為

    11. <input type=button value=查看網(wǎng)頁源代碼
    onclick="window.location = 'view-source:'+ 'http://www.csdn.net/&#39;">

    12. 怎樣通過asp的手段來檢查來訪者是否用了代理
    <% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
    response.write "<font color=#FF0000>您通過了代理服務(wù)器,"& _
    "真實的IP為"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    end if
    %>

    13. 取得控件的絕對位置

    //javascript
    <script language="javascript">
    function getIE(e){
    var t=e.offsetTop;
    var l=e.offsetLeft;
    while(e=e.offsetParent){
    t+=e.offsetTop;
    l+=e.offsetLeft;
    }
    alert("top="+t+"\nleft="+l);
    }
    </script>

    //VBScript
    <script language="VBScript"><!--
    function getIE()
    dim t,l,a,b
    set a=document.all.img1
    t=document.all.img1.offsetTop
    l=document.all.img1.offsetLeft
    while a.tagName<>"BODY"
    set a = a.offsetParent
    t=t+a.offsetTop
    l=l+a.offsetLeft
    wend
    msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"
    end function
    --></script>

    14. 光標是停在文本框文字的最后
    <script language="javascript">
    function cc()
    {
    var e = event.srcElement;
    var r =e.createTextRange();
    r.moveStart('character',e.value.length);
    r.collapse(true);
    r.select();
    }
    </script>
    <input type=text name=text1 value="123" onfocus="cc()">

    15. 判斷上一頁的來源
    asp:
    request.servervariables("HTTP_REFERER")

    javascript:
    document.referrer

    16. 最小化、最大化、關(guān)閉窗口
    <object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
    <param name="Command" value="Minimize"></object>
    <object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
    <param name="Command" value="Maximize"></object>
    <OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
    <PARAM NAME="Command" value="Close"></OBJECT>

    <input type=button value=最小化 onclick=hh1.Click()>
    <input type=button value=最大化 onclick=hh2.Click()>
    <input type=button value=關(guān)閉 onclick=hh3.Click()>
    本例適用于IE

    17.
    <%
    '定義數(shù)據(jù)庫連接的一些常量
    Const adOpenForwardOnly = 0 '游標只向前瀏覽記錄,不支持分頁、Recordset、BookMark
    Const adOpenKeyset = 1 '鍵集游標,其他用戶對記錄說做的修改將反映到記錄集中,但其他用戶增加或刪除記錄不會反映到記錄集中。支持分頁、Recordset、BookMark
    Const adOpenDynamic = 2 '動態(tài)游標功能最強,但耗資源也最多。用戶對記錄說做的修改,增加或刪除記錄都將反映到記錄集中。支持全功能瀏覽(ACCESS不支持)。
    Const adOpenStatic = 3 '靜態(tài)游標,只是數(shù)據(jù)的一個快照,用戶對記錄說做的修改,增加或刪除記錄都不會反映到記錄集中。支持向前或向后移動

    Const adLockReadOnly = 1 '鎖定類型,默認的,只讀,不能作任何修改
    Const adLockPessimistic = 2 '當編輯時立即鎖定記錄,最安全的方式
    Const adLockOptimistic = 3 '只有在調(diào)用Update方法時才鎖定記錄集,而在此前的其他操作仍可對當前記錄進行更改、插入和刪除等
    Const adLockBatchOptimistic = 4 '當編輯時記錄不會被鎖定,而更改、插入和刪除是在批處理方式下完成的

    Const adCmdText = &H0001
    Const adCmdTable = &H0002
    %>

    18. 網(wǎng)頁不會被緩存
    HTM網(wǎng)頁
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    或者<META HTTP-EQUIV="expires" CONTENT="0">
    ASP網(wǎng)頁
    Response.Expires = -1
    Response.ExpiresAbsolute = Now() - 1
    Response.cachecontrol = "no-cache"
    PHP網(wǎng)頁
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");

    19. 檢查一段字符串是否全由數(shù)字組成
    <script language="javascript"><!--
    function checkNum(str){return str.match(/\D/)==null}
    alert(checkNum("1232142141"))
    alert(checkNum("123214214a1"))
    // --></script>

    20. 獲得一個窗口的大小
    document.body.clientWidth,document.body.clientHeight

    21. 怎么判斷是否是字符
    if (/[^\x00-\xff]/g.test(s)) alert("含有漢字");
    else alert("全是字符");

    22.TEXTAREA自適應(yīng)文字行數(shù)的多少
    <textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">
    </textarea>

    23. 日期減去天數(shù)等于第二個日期
    <script language=javascript>
    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)
    </script>

    24. 選擇了哪一個Radio
    <HTML><script language="vbscript">
    function checkme()
    for each ob in radio1
    if ob.checked then window.alert ob.value
    next
    end function
    </script><BODY>
    <INPUT name="radio1" type="radio" value="style" checked>Style
    <INPUT name="radio1" type="radio" value="barcode">Barcode
    <INPUT type="button" value="check" onclick="checkme()">
    </BODY></HTML>

    25.獲得本頁url的request.servervariables("")集合
    Response.Write "<TABLE border=1><!-- Table Header --><TR><TD><B>Variables</B></TD><TD><B>value</B></TD></TR>"
    for each ob in Request.ServerVariables
    Response.Write "<TR><TD>"&ob&"</TD><TD>"&Request.ServerVariables(ob)&"</TD></TR>"
    next
    Response.Write "</TABLE>"

    26.
    本機ip<%=request.servervariables("remote_addr")%>
    服務(wù)器名<%=Request.ServerVariables("SERVER_NAME")%>
    服務(wù)器IP<%=Request.ServerVariables("LOCAL_ADDR")%>
    服務(wù)器端口<%=Request.ServerVariables("SERVER_PORT")%>
    服務(wù)器時間<%=now%>
    IIS版本<%=Request.ServerVariables"SERVER_SOFTWARE")%>
    腳本超時時間<%=Server.ScriptTimeout%>
    本文件路徑<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%>
    服務(wù)器CPU數(shù)量<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>
    服 務(wù)器解譯引擎<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>
    服務(wù)器操作系統(tǒng)<%=Request.ServerVariables("OS")%>

    27.ENTER鍵可以讓光標移到下一個輸入框
    <input onkeydown="if(event.keyCode==13)event.keyCode=9">

    28. 檢測某個網(wǎng)站的鏈接速度:
    把如下代碼加入<body>區(qū)域中:
    <script language=javascript>
    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("<form name=autof>")
    for(var i=1;i<autourl.length;i++)
    document.write("<input type=text name=txt"+i+" size=10 value=測試中……> =》<input type=text name=url"+i+" size=40> =》<input type=button value=GO onclick=window.open(this.form.url"+i+".value)><br/>")
    document.write("<input type=submit value=刷新></form>")
    }
    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<autourl.length;i++)document.write("<img src=http://"+autourl[i]+"/"+Math.random()+" width=1 height=1 onerror=auto('http://";;;+autourl[i]+"')>")}
    run()</script>

    29. 各種樣式的光標
    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

    1、 去掉IE的滾動條
    有時候做好的網(wǎng)頁明明沒有超出窗口,可IE卻偏偏給加上滾動條,這樣看上去很不舒服,其實這也是可以通過一些小技巧避免的。具體如下:
    <body style=”overflow-x:hidden”>…</body> //去掉X軸方向的滾動條
    <body style=”overflow-y:hidden”>…</body> //去掉Y軸方向的滾動條
    <body style=”overflow:hidden”>…</body> //去掉全部的滾動條
    現(xiàn)在你看到的和你想像中的網(wǎng)頁應(yīng)該一樣了吧,如果其中有什么不明白的地方可以參照注釋中的說明。

    2、 使網(wǎng)頁中的復(fù)制無效
    有方法防止網(wǎng)頁被保存了(參見《你別看我的源代碼》),可不可以也防止網(wǎng)頁內(nèi)容被復(fù)制呢?答案是當然可以。看看下面的例子你就會明白的。
    <html>
    <head>
    <script language=”javascript”>
    function nocopy() {
    alert(“對不起,你不能非法復(fù)制本站內(nèi)容”);
    event.returnvalue=false;
    }
    </script>
    </head>
    <body oncopy=”nocopy()”>copyright by commander.</body>
    </html>
    這其實中是利用了document的一個oncopy事件,也就是說當發(fā)生復(fù)制事件時,彈出警告框,同時事件(event)的返回值為false使oncopy事件失效,從而達到防止復(fù)制的目的。

    3、 用腳本控制瀏覽器
    看到標題是不是有點不相信,那么試試下面的這幾個例子吧!你一定會吃驚的。
    在<body>和</body>之間加入如下代碼:
    <button onclick=”document.execCommand(‘open’)”>打開</button>
    <button onclick=”document.execCommand(‘saveas’)”>另存為…</button>
    <button onclick=”document.execCommand(‘print’)”>打印</button>
    上面其實都是利用了document.execCommand()這個內(nèi)置的函數(shù),其參數(shù)為相應(yīng)的瀏覽器命令,還有很多命令就留給大家自己發(fā)現(xiàn)吧!

    4、 IFrame也可以編輯文字
    有沒有想過除了表單(<form>)之外還有其它的網(wǎng)頁元素可以編輯文字呢?只要使用IFrame的隱藏的一個屬性就可以使IFrame成為一個文本編輯器。
    <html>
    <body onload=”editer.document.designMode=’On’”>
    <IFrame ID=”editer”></IFrame>
    </body>
    </html>
    其中designMode屬性表示IFrame的設(shè)計模式的狀態(tài)(開/關(guān)),還在猶豫什么呢,快試試吧!
    只要巧妙的利用這一特性就可以制作很多意想不到的效果。如果下面我們來做一個圖片編輯器。
    <html>
    <body onload=”imgEditer.document.designMode=’On’;imgEditer.document.write(‘<img src=圖片.gif>’)”>
    <IFrame id=”imgEditer”></IFrame>
    </body>
    </html>
    用鼠標點擊圖片是不是有新的發(fā)現(xiàn),其實大家只要利用自己的想象和充分利用這個屬性一定能做出更多的花樣來,別忘了到時候有什么新的東東,告訴我一聲呀!(Email:BluePBoy@yesky.com)

    5、 打開硬盤
    這是打開硬盤的另一種方法,把它寫出來只是想告訴大家,要達到同一個目的有很多種方法,這里就是利用了表單的Action屬性達到的,其實打開硬盤有很多種方法,只是這種不太被人們注意,所以這里就選擇了這種方法。
    <form action="file:///c|/"><input type="submit" value="c:\ drive"></form>

    <p>

    <form action="file:///a|/"><input type="submit" value="a:\ drive"></form>

    <p>

    <form action="file:///b|/"><input type="submit" value="b:\ drive"></form>

    <p>

    <form action="file:///d|/"><input type="submit" value="d:\ drive"></form>

    <p>

    <form action="file:///e|/"><input type="submit" value="e:\ drive"></form>

    posted on 2006-12-05 10:21 無聲 閱讀(380) 評論(0)  編輯  收藏 所屬分類: 職場生活
    主站蜘蛛池模板: 99在线视频免费观看视频 | 可以免费观看的国产视频| 国产av天堂亚洲国产av天堂| 日韩电影免费在线观看| 国产成人亚洲精品| 亚洲欧洲自拍拍偷精品 美利坚| 免费在线看污视频| 亚洲精品精华液一区二区| 亚洲无码视频在线| 最近在线2018视频免费观看| 亚洲狠狠婷婷综合久久| 亚洲av无码精品网站| 日日AV拍夜夜添久久免费| 全免费a级毛片免费看| 精品无码专区亚洲| 亚洲av日韩av无码黑人| 免费一级毛片不卡在线播放| 8x网站免费入口在线观看| 午夜在线免费视频| 亚洲综合色7777情网站777| 亚洲色中文字幕无码AV| 免费鲁丝片一级在线观看| 日韩精品免费视频| eeuss免费天堂影院| 亚洲国产综合精品中文第一| 亚洲va久久久噜噜噜久久狠狠 | 免费无码不卡视频在线观看| 中文字幕无码一区二区免费| 久久久久亚洲国产AV麻豆| 亚洲成a人片在线观看播放| 亚洲综合无码精品一区二区三区 | 亚洲视频在线免费观看| 日韩电影免费在线观看网址| 国产成人精品日本亚洲专| 亚洲妇熟XXXX妇色黄| 亚洲国产一区二区视频网站| 精品免费国产一区二区三区| 四虎永久在线精品免费观看视频| 免费精品久久天干天干| 一级中文字幕免费乱码专区| 亚洲精品无码日韩国产不卡av|