1. Will completely screen the right mouse button
oncontextmenu= "Window.event.returnvalue=false"
2. Deselect, prevent replication
3.JS not allowed to paste
4. js to prevent replication
5. IE Address bar before replacing their own icon
In the root directory of the file into the image, the suffix modified to ico on it
6. You can display your icon in the Favorites folder
7. Close the Input method
8. Always with the frame
< script language= "JavaScript" ><!–
if (window = top) Top.location.href = "frames.htm";//frames.htm for frames page
9. Prevent a person from being frame
< SCRIPT language=javascript><!–
if (top.location!= self.location) top.location=self.location;
10. Web pages will not be saved as
< input Type=button value= View Web page source code
12. Confirm upon deletion
< a href= "javascript:if (confirm) (" Do you want to delete it? ") location= "boos.asp?&areyou= Delete
13. Get the absolute position of the 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 & "left=" &l,64, "get position of control" end
function
14. Cursor is stopped at the end of text box 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>
15. Determining the origin of the previous page
16. Minimize, maximize, 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= closes Onclick=hh3. Click () >
This example applies to IE
17. Screen function Key Shift,alt,ctrl
< script>
function look () {
if (event.shiftkey)
alert ("Do not press Shift key!");//Can be replaced with ALT CTRL
}
Document.onkeydown=look;
18. Web pages are not cached
< META http-equiv= "pragma" content= "No-cache" >
< META http-equiv= "Cache-control" content= "No-cache" Must-revalidate ">
< META http-equiv=" expires "content=" Wed, Feb, 1997 08:21:57 GMT ">
19. How do I make a form without bump and feel?
< input type=text style= "border:1 solid #000000 ″>
Or
< input type=text style= "border-left:none; Border-right:none; Border-top:none; Border-bottom:
What is the difference between 20.< div>< span>&< layer>?
< div> (division) is used to define a large section of the page elements, will produce a career change
< span> to define the same line of elements, and < div> the only difference is not to create a career change
21. Make pop-up windows always on top:
22. Do not scroll bar?
Let the vertical bar not:
<span class= "tag" style= "Color:rgb (0,0,128)" >< <span class= "attribute" style= "Color:rgb (0,128,128)" > body</span> <span class= "attribute" style= "Color:rgb (0,128,128)" >style</span>=<span class= " Value "style=" Color:rgb (221,17,68) ">" Overflow:scroll;overflow-y:hidden "</span>></span>
Let the cross bar not:
<span class= "tag" style= "Color:rgb (0,0,128)" >< <span class= "attribute" style= "Color:rgb (0,128,128)" > body</span> <span class= "attribute" style= "Color:rgb (0,128,128)" >style</span>=<span class= " Value "style=" Color:rgb (221,17,68) ">" Overflow:scroll;overflow-x:hidden "</span>></span>
Two of them removed? It's even simpler.
<span class= "tag" style= "Color:rgb (0,0,128)" >< <span class= "attribute" style= "Color:rgb (0,128,128)" > body</span> <span class= "attribute" style= "Color:rgb (0,128,128)" >scroll</span>=<span class= " Value "style=" Color:rgb (221,17,68) > "No" </span>></span>
23. How to remove the picture link clicked, the dotted line around the picture?
24. e-mail processing submitting form
< form name= "form1″method=" post "action=" mailto:****@***.com "enctype=" Text/plain ">
< input type=submit >
25. How do I write in the code that refreshes the parent window in the Open child window?
26. How to set the size of the open page
< body onload= "Top.resizeto (300,200);" >
Open the location of the page < body onload= "Top.moveby (300,200);" >
27. How to add a background picture that is not full on the page, pull the page when the background image does not move
< style>
body
{background-image:none; background-repeat:no-repeat;
background-position:center;background-attachment:fixed}
</style>
28. Check whether a string of strings is all composed of numbers
< script language= "Javascript" ><!–
function Checknum (str) {return Str.match (//d/) ==null}
alert ( Checknum ("1232142141"))
alert (Checknum ("123214214A1"))
29. Get the size of a window
30. How to judge whether it is a character
if (/[^/x00-/xff]/g.test (s)) alert ("contains Chinese characters");
31.TEXTAREA the number of adaptive lines of text
< textarea Rows=1 name=s1 cols=27 onpropertychange= "This.style.posheight=this.scrollheight" >
32. Date minus days equals second date
< script language=javascript>
function cc (dd,dadd)
{
//can be added error handling
var a = new Date (dd)
a = A.valueof ()
a = a–dadd * * 1000
a = new Date (a)
alert (a.getfullyear () + "year" + (A.getmonth () + 1 + "Month" + a.getdate () + "Day")
}
cc ("12/23/2002", 2)
33. Which Radio was chosen
< 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 ()" >
34. Script never Goes wrong
< SCRIPT language= "JavaScript" >
<!–hide
function killerrors () {return
true;
}
Window.onerror = killerrors;
–>
The ENTER key lets you move the cursor to the next input box
36. Detect the link speed of a website:
Add the following code to the < body> area:
< script language=javascript> tim=1 setinterval ("tim++", MB) 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& Gt = "< 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]["txt" +b].value= "time" +tim/10+ "Seconds"} b++} function run ( {for (var i=1;i< autourl.length;i++) document.write ("< img src=http://" +autourl+ "/" +math.random () + "width=1 Height=1 Onerror=auto ("http://" +autourl+) > ")} run () </script>
37. Various styles of cursors
Auto: Standard cursor
Default: Standard arrow
Hand: hand-shaped cursor
Wait: Waiting for cursor
Text:i-shaped cursor
Vertical-text: Horizontal I-type cursor
No-drop: Non-drag cursor
Not-allowed: Invalid cursor
Help:? Helper cursors
All-scroll: Triangle directional Sign
Move: Moving the label
Crosshair: Cross Mark
E-resize
N-resize
Nw-resize
W-resize
S-resize
Se-resize
Sw-resize
38. Page entry and exit effects
Enter page < 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 special effects when the page is loaded and paged out. Duration represents the duration, in seconds, of the effect.
Transition indicates which special effect is used, which takes a value of
1-23:
0 Rectangle Shrink
1 Rectangle Enlargement
2 round Shrink
3 Circular Enlargement
4 down to top refresh
5 Top to bottom refresh
6 Left to right refresh
7 Right to left flush
8 Vertical Blinds
9 Horizontal Blinds
10 Dislocation Horizontal Blinds
11 Misplaced Vertical Blinds
12 Point spread
13 or so to the middle of the refresh
14 Middle to left flush
15 Middle to bottom
16 up and down to the middle.
17 right down to top left
18 top right to bottom left
19 top left to bottom right
20 left down to top right
21 Cross Bar
22 Vertical Bar
23 or more of 22 randomly selected one
39. Jump within a specified time
40. Whether the Web page has been retrieved
There are some of the following property values:
The property value is "All": The file will be retrieved and the link on the page can be queried;
The property value is "None": The file is not retrieved and the link on the page is not queried;
The property value is "index": The file will be retrieved;
Property value is "Follow": a link on the query page;
The property value is "Noindex": The file is not retrieved but can be queried for links;
The property value is "nofollow": The file is not retrieved, but the link on the page can be queried.
41. Carriage return
Add the document onkeydown event to the page with client script to have the page tab after receiving the carriage return event
The function of the key, that is, as long as the event of the KeyCode from 13 to 9
The Javascript code is as follows:
<script language= "javascript" for= "document" event= "onkeydown" >
<!–
if (event.keycode==13)
event.keycode=9;
–>
This way, you can achieve the focus of moving down, but for the button also play the same role, the average customer in the end of the input
After the data, jump to the button, it is best to directly press "enter" for data submission. So, for the above method,
Modification, you should not focus on the submit button. Instead, direct activation commits.
So I made a modification to the above code, that is, to determine the "source" of the event, is the Submit button, the code is as follows:
<script language= "javascript" for= "document" event= "onkeydown" >
<!–
if (event.keycode==13 & & event.srcelement.type!= ' button ' &&
event.srcelement.type!= ' Submit ' && event.srcelement.type!= ' reset ' &&
event.srcelement.type!= ' textarea ' && event.srcelement.type! = ")
event.keycode=9;
–>
To determine if it is a button, because there will be a type= "button" on the HTML
To decide whether to submit, because the HTML will have type= "submit"
To determine if reset is because the "reset" on HTML should be executed
To determine if it is empty because the "<a> link" on HTML should also be executed, which is not happening much, you can use the "Tabindex=-1″ way to unlink the link to get focus."