1. Completely block the right mouse button

Oncontextmenu = “window.event.returnValue=false” < table border onContextMenu =return(false)>< TD >no< /table> Can be used for table

2. Deselect and prevent replication

< body onselectstart = “return false” >

3.JS does not allow pasting

Onpaste = “return false”

4. JS prevents replication

Oncopy = “return false;” Oncut = “return false;”

5. Change the icon in front of the address bar of Internet Explorer

< link rel= “Shortcut Icon” href= “favicon.ico” >

Put the image in the root directory of the file and change the suffix to ICO

6. You can display your icon in favorites

< link rel = “Bookmark” href = “favicon. Ico” >

7. Disable the input method

< input style = “ime – mode: disabled” >

8. Always carry a frame

< script language = “JavaScript” >

9. Prevent frame

< SCRIPT LANGUAGE=JAVASCRIPT>< ! If (top location! = self.location)top.location=self.location; / / — > < / SCRIPT >

10. Web pages cannot be saved as

< noscript>< iframe src=*.html>< /iframe>< /noscript>

< input type=button value=

The onclick = “window. The location =” view – source: “+” http://www.pconline.com.cn “>”

12. Confirm the deletion

< a href= “javascript:if(” confirm(” do you want to delete? )) location = “boos. Asp? &page=1 “” > Delete < /a>

13. Get the absolute position of the control

//Javascript < script language= “Javascript” > function getIE(e){var t= e.ffsettop; var l=e.offsetLeft; while(e=e.offsetParent){ t+=e.offsetTop; l+=e.offsetLeft; } alert (” top = “+ t +”/nleft = “+ l); < /script> //VBScript < script language= “VBScript” >
“BODY” set a = A.offsetparent t=t+ A.offsetTop L = L + A.offsetleft wend msgbox “Top =” & t&chr (13) & “left =” & l, 64, get controls the location of the “end” function – > < / script >

14. The cursor stops at the end of the text in the text box

< script language = “javascript” >

function cc() { var e = event.srcElement; var r =e.createTextRange(); R.m oveStart (” character “, e.v alue. Length); r.collapse(true); r.select(); } < /script> < input type=text name=text1 value= “123” onfocus= “cc()” >

15. Determine the source of the previous page

javascript:

document.referrer

16. Minimize, maximize, and close Windows

< 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= minimize onclick= hh1.click ()> < input type=button value= maximize onclick= hh2.click ()> < input Type =button value= close onclick=hh3.Click()> this example is applicable to IE

17. Mask function keys Shift,Alt,Ctrl

< script> function look(){if(event.shiftkey) alert(” Do not press Shift key! ); Document. onkeyDown =look; < /script>

18. Web pages are not cached

< META http-equiv = “pragma” CONTENT= “no-cache” > < META http-equiv = “cache-control” CONTENT= “no-cache”, “> < META http-equiv =” expires “CONTENT=” Wed, 26 Feb 1997 08:21:57 GMT “> or < META http-equiv =” Expires “CONTENT=” 0 “>

19. How to make forms non-convex?

< input type=text style= “border:1 solid #000000” > < input type=text style= “border-left:none; border-right:none; border-top:none; Border-bottom: 1 solid #000000 “>< /textarea>

< div>< span>&< layer>

< div>(division) is used to define large sections of page elements, resulting in line transitions. < span> is used to define elements within the same line. The only difference is that < div> does not generate line transitions.

21. Keep pop-ups on top:

< body onblur = “this. Focus ();” >

22. Don’t scroll bars?

< p style= “overflow:scroll; “> < span style=” overflow:scroll; Overflow-x :hidden “> < /body> < body scroll= “no” > < /body>

23. How to remove the dotted line around the image after clicking the image link?

< a href = “#” an onFocus = “enclosing the blur ()” > < img SRC = “logo. JPG” border = 0 > < / a >

24. Email processing submission forms

< form name= “form1” method= “post” action= “mailto:****@***.com” encType = “text/plain” > < input type= “submit” > < /form>

25. How to write in the code to refresh the parent window in the open child window?

window.opener.location.reload()

26. How to set the size of the open page

< body onload = “top. ResizeTo (300200);” < body onload= “top.moveby (300,200);” >

27. How do I add a background image that is not fully covered and does not move when I pull the page

< STYLE> body {background-image:url(logo.gif); background-repeat:no-repeat; background-position:center; background-attachment: fixed} < /STYLE>

28. Check whether a string consists entirely of numbers

< script language = “Javascript” >
< / script >

29. Get the size of a window

document.body.clientWidth; document.body.clientHeight

30. How to check whether it is a character

If (/[^/x00-/ XFF]/g.test(s)) alert; Else alert(” full of characters “);

31. How many lines of text are adaptive to TEXTAREA

< textarea rows=1 name=s1 cols=27 onpropertyChange = “this.style.posheight =this.scrollHeight” > < /textarea>

32. The date minus the number of days equals the second date

Var a = new Date(dd) a = a.valueof () a = a — dadd * 24 * 60 * 60 * 1000 a = new Date(a) alert(a.goetfullYear () + “year” + (a.goetmonth () + 1) + “month” + a.goetdate () + “day”)} Cc (” 12/23/2002 “, 2) < / script >

33. Which Radio is selected

< 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>

34. Scripts never go wrong

< SCRIPT LANGUAGE= “JavaScript” >
< / SCRIPT >

35. The ENTER key moves the cursor to the next input field

< input onkeydown = “if (event. KeyCode = = 13) event. The keyCode = 9” >

36. Check the link speed of a site:

Add the following code to the < body> area: < 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= test…… < input type=text name=url “+ I +” size=40> = “< input type=button value=GO Onclick =window.open(this.form.url “+ I +”.value)> “) document.write(” < input type=submit value= refresh >< /form> “)} butt() Function auto(url){document.forms[0][” url “+b]. Value =url if(Tim >200) {document.forms[0][” TXT” +b]. Value = “link timeout”} else {document. Forms [0] [r]. “TXT” + b + Tim/value = “time” 10 + “seconds”} b++} function the run () {for (var I = 1; i< autourl.length; I++)document.write(” < img SRC = http://autourl + “/” + math.random ()+ “width=1 height=1 Onerror = auto + autourl + “”) (” http://” > “)} the run () < / script >

37. Various styles of cursor

Auto: standard cursor Default: standard arrow Hand: hand-shaped cursor Wait: waiting cursor TEXT: i-shaped cursor vertical-text: horizontal I-shaped cursor NO-DROP: cannot drag the cursor not-allowed: Invalid cursor help:? Help cursor All-scroll: triangle pointer move: crosshair: cross pointer E-resize N-resize NW-resize S-resize se-resize sw-resize

Page entry and exit effects

< meta http-equiv= “page-enter” content= “revealTrans(duration=x, Transition = Y) “> Launch Page < meta http-equiv=” page-exit “Content =” revealTrans(duration=x, transition=y) “> This is some of the special effects of the Page being loaded and called out. Duration Specifies the duration of a special effect, in seconds. Transition indicates which effect to use. The value ranges from 1 to 23: 0 Rectangle shrink 1 Rectangle enlarge 2 Circle shrink 3 Circle enlarge 4 Bottom to top refresh 5 top to bottom refresh 6 left to right refresh 7 right to left refresh 8 Vertical louver 9 Horizontal louver 10 Misplaced horizontal louver 11 Misplaced vertical louver 12 point spread 13 left to middle refresh 14 Refresh from the middle to the left and right 15 From the middle to the top and bottom 16 from the top and bottom to the middle 17 From the bottom right to the upper left 18 from the top right to the bottom left 19 from the top left to the bottom right 20 from the bottom left to the top right 21 Horizontal bars 22 Vertical bars 23 From above 22 Select one randomly

39. Jump within the specified time

< META HTTP – equiv = V = “REFRESH” content = “5; URL=http://www.51js.com “>

40. Whether the web page is retrieved

< meta name= “ROBOTS” content= “attribute value” > The following attribute values are available: if the attribute value is “all”, the file will be retrieved, and the links on the page can be queried; Property value of “None” : files are not retrieved and links on pages are not queried; Property value “index” : the file will be retrieved; Property value “follow” : query the links on the page; Property value “noIndex” : the file is not retrieved, but can be queried links; Property value “nofollow” : files are not retrieved, but links on pages can be queried.

41. The enter

Add the onKeyDown event of document to the page with the client script, so that the page can Tab after receiving the return event, that is, change the keyCode of event from 13 to 9. The Javascript code is as follows: In this way, the focus can be moved down, but the button also plays the same role, the general customer after input data, after jumping to the button, it is best to directly press “Enter” for data submission. Therefore, the above method should be modified so that there should be no focus shift for the “Submit” button. Instead, activate commit directly. Therefore, I made a modification to the above code, that is, to determine whether the “source” of the event is a submit button, the code is as follows: Check whether it is button, It’s because there’s type= “button” in the HTML and it’s submit, it’s because there’s type= “submit” in the HTML and it’s reset, it’s because the reset in the HTML should be done and it’s empty because of the HTML The “link” on the “tabIndex” should also be executed, which is rare and can be unlinked to gain focus by using “tabIndex =-1”.

Phone scan the qr code above follow PHP novice official wechat phpXS8 chat about programming technology chat about programming life.