Screen the right key to the page
<body oncontextmenu= "return false" > or <body style= "Overflow-y:hidden" >
Add background music to a Web page
Ie:<bgsound src= "*.mid" loop=infinite>
ns:<embed src= "*.mid" Autostart=true hidden=true loop=true></embed>
*.MID MIDI format file for your background music
Automatically open and close windows
<script language= "& #106avascript" >
function Winopen1 () {
Open the window name =open ("NB", "homepage", "Toolbar=no,location=no,
Directories=no,status=no,menubar=no,scrollbars=no,resizable=no,
Copyhistory=no,width=160,height=200,left=200,top=100 "; )
</script>
<a href onmouseover= "winopen1 (); return true;" onmouseout= "open Window name. Close ();" >
<p> here is the connection </a></p>
Let the browser fail while saving the page so that the user cannot save the web face
<noscript><iframe src= "*.html" ></iframe></NOSCRIPT>
Web page automatically closes
<object id=closes type= "Application/x-oleobject"
Classid= "Clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" >
<param name= "Command" value= "Close" >
</object>
<body onload= "Window.settimeout" (' closes. Click () ', 10000 ' >
This window will automatically close after 10 seconds without prompting.
</body>
More tips:
1. oncontextmenu= "Window.event.return value=false" will completely screen the right mouse button
<table border Oncontextmenu=return (false) ><td>no</table> available for table
2. <body onselectstart= "return false" > deselect, prevent copying
3. onpaste= "return false" is not allowed to paste
4. oncopy= ' return false; ' oncut= ' return false; ' Prevent replication
5. <link rel= "shortcut icon" href= "Favicon.ico" > IE Address bar before replacing their own icons
6. <link rel= "Bookmark" href= "Favicon.ico" > can display your icon in a Favorites folder
7. <input style= "ime-mode:disabled" > Close IME
8. Always with the frame
<script language= "JavaScript" ><!--
if (window = top) Top.location.href = "frames.htm"; file& #58//frames.htm for frames page
--></script>
9. Prevent a person from being frame
<script language=javascript><!--
if (top.location!= self.location) top.location=self.location;
--></script>
<noscript><iframe src=*.html></iframe></noscript> Web pages will not be saved as
<input type=button value= View Web page source code
onclick= "window.location = ' view-source: ' + ' http://www.jb51.net/'" >
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>
<input type=text name=text1 value= "123" onfocus= "CC ()" >
15. Determining the origin of the previous page
Asp:
Request.ServerVariables ("Http_referer")
Javascript:
Document.referrer
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
18. Web pages are not cached
HTM Web page
<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" >
or <meta http-equiv= "expires" content= "0" >
19. 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"))
--></script>
21. How to judge whether it is a character
if (/[^\x00-\xff]/g.test (s)) alert ("contains Chinese characters");
else alert ("All characters");
22.TEXTAREA the number of adaptive lines of text
<textarea Rows=1 name=s1 cols=27 onpropertychange= "This.style.posheight=this.scrollheight" >
</textarea>
23. Date minus days equals second date
<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 () + "year" + (A.getmonth () + 1) + "month" + a.getdate () + "Day")
}
CC ("12/23/2002", 2)
</script>
The 27.ENTER key allows the cursor to move to the next input box
<input onkeydown= "if (event.keycode==13) event.keycode=9" >