Secondary code
Click to return to the previous page code:
Copy Code code as follows:
<form>
<p><input type= "button" value= "Back" onclick= "History.back ( -1)" ></p>
</form>
Pop-up warning Box code:
<form> <p><input type= "button" value= "Pop-up Warning box" onclick= "Alertbutton ()" ></p> </form> < Script language= "JavaScript" ><!--function Alertbutton () {Window.alert. ");} --></script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Click to open a new window
<form> <p><input type= "button" value= "open new Window" onclick= "NewWindow ()" ></p> </form> <SC Ript language= "JavaScript" ><!--function NewWindow () {window.open ("http://www.whitehouse.net.cn", "", "height= 240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no ");} --></script></body>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Pop-up confirmation box when deleting a record:
<script language= "VBSCRIPT" > A=msgbox ("Do you really want to delete this record?") ", 1," note ") if A=1 then location=" dodelete.asp?id=<%=id%> "//point to the page that performs the deletion dodelete.asp else History.go ( -1) End If </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Close an open window
<a href= "/" onclick= "javascript:window.close (); return false; > Close Window </a>
Empty input and select
onclick= "javascript:this.value=" "onfocus=" This.select () "onmouseover=" This.focus () "
Right-click Mask
<body oncontextmenu=self.event.returnvalue=false>
How to solve the line-wrapping in English IE5.5
Style= "left:0px; width:100%; Word-wrap:break-word "You can modify to a specified size such as 200px
Picture "Reset" button
<script language= "JScript" >
function Myreset ()
{Document.login.reset ();
Document.login.focus ();}
</script>
Draw a thin form
<table style= "Border-collapse:collapse" >
Status bar Information
<form>
<p><input type= "button" value= "status bar Info" onclick= "Statusbutton ()" ></p>
</form>
<script language= "JavaScript" ><!--
function Statusbutton () {window.status= "to visit!" ";}
--></script>
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
Hide link information appearing in the status bar
<a href= "http://"; Onmouseover= "window.status= ' None '; return true" > Dream Sky </a>
text box Auto scroll bar
<textarea name=words rows=18 cols=26 style= "border:1 solid #000000; font-size:9pt; width:188; Overflow:auto "wrap=hard></textarea>
Select All and copy
<form name=test><input onclick= "Javascript:highlightall (' Test.select1 ')" Type=button value= Select all and copy >< Br><textarea name=select1 rows=3 cols=46> Hello, welcome to your visit! </TEXTAREA>
</FORM>
<script language=javascript>
<!--
var copytoclip=1
function Highlightall (Thefield) {
var tempval=eval ("document.") +thefield)
Tempval.focus ()
Tempval.select ()
if (document.all&©toclip==1) {
Therange=tempval.createtextrange ()
Therange.execcommand ("Copy")
Window.status= "Contents highlighted and copied to clipboard!"
settimeout ("window.status=", 1800)
}
}
-->
</SCRIPT>
Masking JavaScript errors
<script language= "JavaScript" >
<!--
function Killerrors () {
return true;
}
Window.onerror = killerrors;
-->
</script>
Refresh parent window when child window is closed
<script language= "JavaScript" >
<!--
Self.opener.location.reload ();
Window.close ()
-->
</script>
Background color transformation
<form><p><input type= "button" value= "Background color transform" onclick= "Bgbutton ()" ></p>
</form>
<script>function Bgbutton () {
if (document.bgcolor== ' #00ffff ')
{document.bgcolor= ' #ffffff ';}
Else{document.bgcolor= ' #00ffff ';}
}
</script>
Check whether a string of strings is composed entirely of digits
<script language= "Javascript" ><!--
function Checknum (str) {return Str.match (//d/) ==null}
Alert (Checknum ("1232142141"))
Alert (Checknum ("123214214A1"))
--></script>
Judge whether it is a character
if (/[^/x00-/xff]/g.test (s)) alert ("contains Chinese characters");
Click the Refresh code:
<form>
<p><input type= "button" value= "refresh button" onclick= "Reloadbutton ()" ></p>
</form>
<script language= "JavaScript" ><!--
function Reloadbutton () {location.href= "allbutton.htm";}
--></script>
Let the layer not be covered by the control code:
<div Z-index:2><object xxx></object></div> # Front
<div Z-index:1><object xxx></object></div> # behind
<div id= "Layer2" style= "Position:absolute; top:40;width:400px; Height:95px;z-index:2 "><table height=100% width=100% bgcolor=" #ff0000 "><tr><td height=100% 100%></td></tr></table><iframe width=0 height=0></iframe></div>
<div id= "Layer1" style= "Position:absolute; top:50;width:200px; Height:115px;z-index:1 "><iframe height=100% width=100%></iframe></div>
Let the relative position of the layer
<div id= "Layer1" style= "position:relative; left:0px; top:0px; width:0px; Height:0px;z-index:1 ">
<div id= "Layer2" style= "Position:absolute; left:500px; top:0px; width:220px; height:220px; Z-index:1 ">
Content
</div></div>
Flash code and background transparency
<object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase= "http://download.macromedia.com/pub/ shockwave/cabs/flash/swflash.cab#version=6,0,29,0 "width=" height= ">"
<param name= "movie" value= "File" >
<param name= "Quality" value= "High" >
<param name= "wmode" value= "Transparent" >
<embed src= "images/fish.swf" quality= "High" pluginspage= "http://www.macromedia.com/go/getflashplayer" Application/x-shockwave-flash "width=" height= "the", "the" ></embed></object>
Windows Media player player
<object Id=mediaplayer1
Style= "left:0px; visibility:visible; Position:absolute; Top:0px;z-index:2 "
codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701standby=
Loading
Type=application/x-oleobject height=300 width=320
Classid=clsid:6bf52a52-394a-11d3-b153-00c04f79faa6 viewastext>
<param name= "URL" value= "Address" >
<param name= "Audiostream" value= "-1" >
<param name= "AutoSize" value= "0" >
<param name= "AutoStart" value= "-1" >
<param name= "Animationatstart" value= "0" >
<param name= "Allowscan" value= "-1" >
<param name= "Allowchangedisplaysize" value= "-1" >
<param name= "Autorewind" value= "0" >
<param name= "Balance" value= "0" >
<param name= "BaseURL" value>
<param name= "Bufferingtime" value= "5" >
<param name= "Captioningid" value>
<param name= "Clicktoplay" value= "-1" >
<param name= "CursorType" value= "0" >
<param name= "currentposition" value= "-1" >
<param name= "Currentmarker" value= "0" >
<param name= "Defaultframe" value>
<param name= "Displaybackcolor" value= "0" >
<param name= "Displayforecolor" value= "16777215" >
<param name= "DisplayMode" value= "0" >
<param name= "Displaysize" value= "4" >
<param name= "Enabled" value= "-1" >
<param name= "Enablecontextmenu" value= "-1" >
<param name= "Enablepositioncontrols" value= "0" >
<param name= "Enablefullscreencontrols" value= "0" >
<param name= "Enabletracker" value= "-1" >
<param name= "Invokeurls" value= "-1" >
<param name= "Language" value= "-1" >
<param name= "Mute" value= "0" >
<param name= "Playcount" value= "1" >
<param name= "PreviewMode" value= "0" >
<param name= "Rate" value= "1" >
<param name= "Samilang" value>
<param name= "Samistyle" value>
<param name= "Samifilename" value>
<param name= "SelectionStart" value= "-1" >
<param name= "Selectionend" value= "-1" >
<param name= "sendopenstatechangeevents" value= "-1" >
<param name= "sendwarningevents" value= "-1" >
<param name= "senderrorevents" value= "-1" >
<param name= "sendkeyboardevents" value= "0" >
<param name= "sendmouseclickevents" value= "0" >
<param name= "sendmousemoveevents" value= "0" >
<param name= "sendplaystatechangeevents" value= "-1" >
<param name= "showcaptioning" value= "0" >
<param name= "Showcontrols" value= "-1" >
<param name= "Showaudiocontrols" value= "-1" >
<param name= "Showdisplay" value= "0" >
<param name= "Showgotobar" value= "0" >
<param name= "Showpositioncontrols" value= "-1" >
<param name= "ShowStatusBar" value= "-1" >
<param name= "Showtracker" value= "-1" >
<param name= "Transparentatstart" value= "-1" >
<param name= "videoborderwidth" value= "0" >
<param name= "Videobordercolor" value= "0" >
<param name= "Videoborder3d" value= "0" >
<param name= "Volume" value= ">"
<param name= "Windowlessvideo" value= "0" >
</OBJECT>
RealPlayer player
<object id=video1 classid= "CLASID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA"
width=320 height=240 align= "Middle" >
<param name= "Controls" value= "Inagewindow" >
<param name= "Console" value= "CHICP1" >
<param name= "AutoStar" value= "true" >
<param name= "src" value= "address" >
<embed
src= "Address"
Type= "Audio/x-pn-realaudio-plugin" console= "Chip1"
controls= "Imagewindow" width=320 height=240 autostart=true align= "Middle" >
</embed>
</object>