This paste is mainly to collect a variety of comparative primer code
hide and display of layers
Just set the display property of style to
such as <div style= "Display:none" id= "mydiv" > Hidden layers </div>
If you want to show it, you can control it by scripting.
Window.document.getElementById ("Mydiv"). Style.display = "";
No right key
<body oncontextmenu= "return false" >
program run error message in screen page
Window.onerror = function ()
{
return true;
}
get the resolution of the current monitor
Window.srceen.width get the width of the screen
Window.srceen.height get the height of the screen
If the current resolution is 800*600,window.srceen.width 800,window.srceen.height is 600
run specific code regularly
SetTimeout (code,timeout);
SetInterval (code,timeout);
Code is a string, the inside is JS, timeout is a time interval, the unit is microseconds
SetTimeout run the code from the number of microseconds it is now (run only once)
SetInterval is running code every few microseconds
get the website of this page
var Url = window.location.href;
Save the contents of the current page
Document.execcommand ("SaveAs", "" "," c:\\index.htm ");
hide in the browser when you move the mouse over the picture to jump out of the toolbar
Or
<meta http-equiv= "Imagetoolbar" content= "no" >
Open, Save As, properties, print "etc 14 JS code
Open
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (1,1) Type=button value= open >
<object classid=clsid:8856f961-340a-11d0-a96b-00c04fd705a2 height=0 Id=webbrowser width=0></OBJECT>
Save As
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (4,1) Type=button value= Save as ><object Classid=CLSID : 8856F961-340A-11D0-A96B-00C04FD705A2 height=0 Id=webbrowser width=0></object>
Property
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (10,1) Type=button value= Properties ><object Classid=CLSID : 8856F961-340A-11D0-A96B-00C04FD705A2 height=0 Id=webbrowser width=0></object>
Print
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (6,1) Type=button value= print ><object Classid=CLSID : 8856F961-340A-11D0-A96B-00C04FD705A2 height=0 Id=webbrowser width=0></object>
Page Setup
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (8,1) Type=button value= Page Setup ><object classid= CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 Id=webbrowser width=0></object>
Refresh
<input Type=button value= Refresh Name=refresh onclick= "Window.location.reload ()" >
Import Favorites
<input type= "button" name= "button" value= "Import Favorites" Onclick=window.external.importexportfavorites (True);>
Export Favorites
<input type= "button" Name= "Button3" value= "Export Favorites" Onclick=window.external.importexportfavorites (false);>
Add to Favorites
<input name=button2 onclick= "Window.external.AddFavorite (Location.href, Document.title)" Type=button value= Add Favorites >
Organize Favorite Folders
<input name=submit2 onclick= "Window.external.ShowBrowserUI (organizefavorites, null)" Type=button value= collating favorites >
View Original file
<input Name=button onclick=window.location = "View-source:" + window.location.href Type=button value= View Source files >
Language Settings
<input Name=button onclick= "Window.external.ShowBrowserUI (Languagedialog, null)" Type=button value= language Settings >
Forward
<input name=submit onclick=history.go (1) type=submit value= forward >
Back
<input name=submit2 onclick=history.go ( -1) type=submit value= back >