Common HTML special effect code
1. Ignore the right click
<bodyoncontextmenu=returnfalse>
or
<bodystyle=overflow-y:hidden>
2. Add background music
IE:<bgsoundsrc=*.midloop=infinite>
NS:<embedsrc=*.midautostart=truehidden=trueloop=true>
</embed>
*.mid your background music in midi format file
3. Simple window.open method
<ahref=#
onclick=javascript:window.open(file path/file name,newwindow,
toolbar=no,scrollbars=yes,resizable=no,top=0,left=0,
width=400,height=300);>Text or picture</a>
Parameter explanation:
<SCRIPTLANGUAGE=javascript>js script starts;
window.open command to pop up a new window;
File path/file name of the pop-up window;
The name of the newwindow pop-up window (not the file name), which is not necessary, can be replaced by empty;
width=400 window width;
height=300 window height;
top=0 The pixel value of the window is above the screen;
left=0 The pixel value of the window from the left side of the screen;
toolbar=no Whether to display the toolbar, yes is the display;
menubar, scrollbars means menu bar and scrollbar.
resizable=no is allowed to change the window size, yes is allowed;
location=no whether to display the address bar, yes is allowed;
status=no displays information in the status bar (usually the file is already open), yes is allowed;
</SCRIPT>js script end
4. Simple page encryption
<scriptLANGUAGE=javascript>
<!--
functionloopy(){
varsWord=;
while(sWord!=login){sWord=prompt(please enter your login password);}
alert(Login successfully!);
}
loopy()
//-->
</script>
5. The background image remains unmoved when pulling the page
<style>
body{background-image:url(logo.gif);
background-repeat:no-repeat;background-position:center}
</style>
6. Let the browser save the page fail
<NOSCRIPT><iframesrc=*.html></iframe></NOSCRIPT>
7. Random replacement pictures
<script>
document.write(<imgsrc=img/+parseInt(Math.random()*(5))
+.gifheight=40width=50>
</script>
The image file name is 0.gif1.gif2.gif3.gif4.gif
8. The window is closed regularly
First, put the following code in the area of the web page file:
<scriptlanguage=javascript>
functioncloseit(){setTimeout(self.close(),10000)//ms}
</script>
Then add the following in the <body> tag: <bodyonload=closeit()>
9. Automatically close the web page
<html>
<head>
<objectid=closetype=application/x-oleobject
classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11>
<paramname=Commandvalue=Close>
</object>
</head>
<bodyonload=window.setTimeout(closes.Click(),10000)>
This window will automatically close after 10 seconds, and there will be no prompt.
</body>
</html>
10. Automatic refresh of web pages
Recorded in the head office
<METAHTTP-EQUIV=Refreshcontent=20>
20 of which will automatically refresh after 20 seconds, and you can change it to any value.
11. Automatic page conversion
<METAHTTP-EQUIV=RefreshCONTENT=Time(seconds);URL=Address>
12. Keep the layer at the front and not overwritten by Iframe or Object
Insert Iframe or Object in Layer to set the z-Index value
<divz-Index:2><objectxxx></object>#Front
<divz-Index:1><objectxxx></object>#Back
<divid=Layer2style=position:absolute;top:40;width:400px;
height:95px;z-index:2>height=100%width=100%>
<iframewidth=0height=0></iframe>
</div>
<divid=Layer1style=position:absolute;top:50;width:200px;
height:115px;z-index:1>
<iframeheight=100%width=100%></iframe>
</div>
13. Return to the previous page
<ahref=javascript:history.back(1)>『Return to previous page』</a>
14. Close the window
<ahref=javascript:self.close()>『Close window』</a>
15. Transparent background about iframe
<IFRAMEID=iFrame1SRC=iframe.htm
allowTransparency=true
style=background-color:green></IFRAME>
16.oncontextmenu=window.event.returnValue=false will completely block the right mouse button
<tableborderoncontextmenu=return(false)><td>no</table> can be used for Table
17.<bodyonselectstart=returnfalse>Unselecting and preventing copying
18.onpaste=returnfalse is not allowed to paste
19.oncopy=returnfalse;oncut=returnfalse; prevent copying
20. Change it to your own icon in front of the IE address bar
21.<linkrel=Bookmarkhref=favicon.ico> can display your icon in your favorites
22. <inputstyle=ime-mode:disabled> Close input method
23. Always carry a frame
<scriptlanguage=JavaScript><!--
if(window==top)top.location.href=frames.htm;//frames.htm is the frame web page
//--></script>
24. Prevent frames from being
<SCRIPTLANGUAGE=JAVASCRIPT><!--
if(top.location!=self.location)top.location=self.location;
//--></SCRIPT>
25. Web pages will not be saved as
<noscript><iframesrc=*.html></iframe></noscript>
26. View the web page source code
<inputtype=buttonvalue=View the web page source code onclick=window.location=view-source:+http://www.pconline.com.cn>
27. Confirm when deleting
<ahref=javascript:if(confirm(do you really need to delete?)) location=boos.asp?&areyou=delete&page=1>delete</a>
28. Block function keys Shift, Alt, Ctrl
<script>
functionlook(){
if(event.shiftKey)
alert (Shift key is prohibited!);//can be replaced with ALT CTRL
}
document.onkeydown=look;
</script>