40 kinds of commonly used on the web skills (javascript)

  1. Oncontextmenu = "window.event.returnValue = false" will be completely shielded Right 
  <table Border oncontextmenu=return(false)> <td> no </ table> can be used to Table 

  2. <body Onselectstart="return false"> deselect to prevent copying 

  3. Onpaste = "return false" No paste 

  4. Oncopy = "return false;" oncut = "return false;" to prevent reproduction 

  5. <link Rel="Shortcut Icon" href="favicon.ico"> IE address bar replaced their former icon 

  6. <link Rel="Bookmark" href="favicon.ico"> Favorites folder can show you the icon 

  7. <input Style="ime-mode:disabled"> closed input method 

  8. Always with a framework 
  <script Language="JavaScript"> <! – 
  If (== top window) top.location.href = "frames.htm" / / frames.htm framework website 
  / / –></ Script> 

  9. Preventing the frame 
  <SCRIPT LANGUAGE=JAVASCRIPT> <! – 
  If (top.location! = Self.location) top.location = self.location; 
  / / –></ SCRIPT> 

  10. Page will not be for the Save 
  <noscript> <iframe Src=*.html> </ iframe> </ noscript> 

  11. <Input type = button value = Show website source code 
  Onclick = "window.location =" view-source: "+" http://www.pconline.com.cn ""> 

  12. Delete confirmed 
  <a Href="javascript:if(confirm("确实要删除吗?")) location="boos.asp?&areyou=删除& page=1""> delete </ a> 

  13. Obtain the absolute position control 
  / / 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, "get control of the position." 
  End function 
  –></ Script> 

  14. Stops the cursor in the text box is the final text 
  <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. Previous judgement of the source 
  Javascript: 
  Document.referrer 

  16. Minimize, maximize, Close Window 
  <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= Cuoxiaohua onclick=hh1.Click()> 
  <input Type=button value= maximize onclick=hh2.Click()> 
  <input Type=button value= closed onclick=hh3.Click()> 
  This apply to IE 

  17. Shielding function keys Shift, Alt, Ctrl 
<script>
  Function look () ( 
  If (event.shiftKey) 
  Alert ( "prohibited by the Shift key!"); / / Can be replaced with ALT CTRL 
  ) 
  Document.onkeydown = look; 
  </ Script> 

  18. Website will not be cached 
  <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"> 
  Or <META HTTP-EQUIV = "expires" CONTENT = "0"> 

  19. Aotugan not how to form? 
  <input Type=text style="border:1 solid #000000"> 
  Or 
  <Input type = text style = "border-left: none; border-right: none; border-top: none; border-bottom: 

  A solid # 000000 "> </ textarea> 

  20. <div> <span> & <layer> The difference? 
  <div> (Division) to the definition of the page elements will produce switch 
  <span> To define elements within the same line with the <div> The only difference is not a switch 
  <layer> Is ns markings, ie does not support, equivalent to <div> 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Recommend Articles

Comments

Leave a Reply