javascript| Essence | Web page
"1, normal pop-up window" http://www.alixixi.com/web/a/
<script language=javascript>
<!--
window.open (' page.html ')
-->
</SCRIPT> http://www.alixixi.com/web/a/
<!--and--> are useful for some versions of browsers that do not display the code in the label as text in these old browsers. Both single and double quotes are OK, just don't mix. http://www.alixixi.com/web/a/
"2, after the Set pop-up window" http://www.alixixi.com/web/a/
<script language=javascript>
<!--
window.open (' page.html ', ' newwindow ', ' height=100, width=400, Top=0, left=0, Toolbar=no, Menubar=no, Scrollbars=no, Resizable=no,location=no, Status=no ')
Write a line
-->
</SCRIPT> http://www.alixixi.com/web/a/
Parameter explanation: http://www.alixixi.com/web/a/
<script language=javascript> js script started;
window.open the command to eject a new window;
The filename of the ' page.html ' pop-up window;
' NewWindow ' pop-up window name, not required, available empty ' instead;
height=100 window height;
width=400 window width;
The pixel value of the Top=0 window from the top of the screen;
The pixel value of the left=0 window from the left side of the screen;
Toolbar=no whether the toolbar is displayed, yes for display;
Menubar,scrollbars represents the menu bar and scroll bar.
Resizable=no whether to allow changes to the window size, yes to allow;
Location=no whether the address bar is displayed, yes is allowed;
Status=no whether the information in the status bar is displayed (usually the file is open), yes to allow;
</SCRIPT> JS script End http://www.alixixi.com/web/a/
"3, control pop-up window with function" http://www.alixixi.com/web/a/
The following is a complete code. http://www.alixixi.com/web/a/
<script language=javascript>
<!--
function Openwin () {
window.open (page.html, NewWindow, height=100, width=400, Toolbar=no, Menubar=no, Scrollbars=no, Resizable=no, location =no, Status=no)
Write a line
}
-->
</script>
<body Onload=openwin () >
.....
</body>
Here defines a function openwin (), how to call it? http://www.alixixi.com/web/a/
Method One: <body onload=openwin () > Browser pop-up window when reading the page;
Method Two: <body Onunload=openwin () > Browser out of the page pop-up window;
Method Three: Call with a link: Method four: Call with a button: http://www.alixixi.com/web/a/
"4, pop-up 2 windows at the same time" http://www.alixixi.com/web/a/
Change the source code slightly: http://www.alixixi.com/web/a/
<script language=javascript>
<!--
function Openwin () {
window.open (page.html, NewWindow, height=100, width=100, Top=0, Left=0,toolbar=no, Menubar=no, Scrollbars=no, Resizable=no, Location=no, Status=no)
Write a line
window.open (page2.html, NewWindow2, height=100, width=100, top=100, Left=100,toolbar=no, Menubar=no, Scrollbars=no, Resizable=no, Location=no, Status=no)
Write a line
}
-->
</script> http://www.alixixi.com/web/a/
To avoid the 2 windows that pop up, use top and left to control the pop-up positions without overwriting each other. The last four methods mentioned above can be invoked. http://www.alixixi.com/web/a/
Note: The name of the 2 windows (NewWindows and NewWindow2) is not the same, or simply all empty. http://www.alixixi.com/web/a/
"5, the main window opens the file 1.htm, simultaneously pops up the small window page.html" http://www.alixixi.com/web/a/
Add the following code to the main window
<script language=javascript>
<!--
function Openwin () {
window.open (page.html,,width=200,height=200)
}
-->
</script>
Join <body> Area:
<a href=1.htm Onclick=openwin () >open</a>. http://www.alixixi.com/web/a/
"6, pop-up window of the timed shutdown control" http://www.alixixi.com/web/a/
Below we have some control of the pop-up window, the effect is better. If we add a small piece of code to the pop-up page (note is added to the page.html HTML, not the main page, otherwise ...), let it automatically shut down in 10 seconds is it cooler? http://www.alixixi.com/web/a/
First, add the following code to the
<script language=javascript>
function Closeit () {
SetTimeout (Self.close (), 10000)//MS
}
</script> http://www.alixixi.com/web/a/
Then, then use <body Onload=closeit () > This sentence to replace the page.html in the central some <BODY> this sentence on it. (Don't forget to write this sentence!) The function of this sentence is to call the code that closes the window, and then close the window itself after 10 seconds. ) http://www.alixixi.com/web/a/
"7, add a Close button in the pop-up window" http://www.alixixi.com/web/a/
<FORM>
<input type= ' BUTTON ' value= ' close '; This.home.setHomePage (
http://www.alixixi.com/web/a/
http://www.webjx.com/[/url] ';
}
var Focusok=false;
if (navigator.appname = = netscape{
Focusok=true;
}
Vers=navigator.appversion;
if (navigator.appname = = Microsoft Internet explorer{
Pos=vers.lastindexof ('. ');
Vers=vers.substring (pos-1,vers.length);
}
Proper_version=parsefloat (vers); http://www.alixixi.com/web/a/
if (proper_version>=5) {
Focusok=true;
}
function Launchstock1 (htmlurl) {
var stock=window.openhttp://www.alixixi.com/web/a/
(htmlurl,stock,top=2,left=2,toolbar=no,location=no,directories=no,status=no,menubar=no,scrohttp://www.alixixi.com/web/a/
Llbars=yes,
resizable=no,width=700,height=510;
if (Focusok) {
Stock.focus ();
}
return true;
}
function Launchstock () {
var stock=window.openhttp://www.alixixi.com/web/a/
(, stock,top=2,left=2,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=http://www.alixixi.com/web/a/
yes,http://www.alixixi.com/web/a/
resizable=no,width=700,height=510;
if (Focusok) {
Stock.focus ();
}
return true;
}
-->
</script>
<a href=# name=home onclick=defaul_home (); Title===e Time ==> Set homepage </a>http://www.alixixi.com/web/a/
18. Here is the code to add Favorites http://www.alixixi.com/web/a/
<a href=# onclick=window.external.addfavorite (http://www.webjx.com ';. ') Dawn Accord ') target=_self title= Dawn Accord > Add Favorites </a>http://www.alixixi.com/web/a/
19.flash Picture Effect
The following code joins the <script language=javascript>
<!--
function Makevisible (Cur,which) {
if (which==0)
cur.filters.alpha.opacity=100
Else
Cur.filters.alpha.opacity=20
}http://www.alixixi.com/web/a/
-->http://www.alixixi.com/web/a/
</SCRIPT>
The following code joins the <body> area
(this,0) onmouseout=makevisible (this,1) width=63 height=56>//Picture address please change yourself http://www.alixixi.com/web/a/
20.load progress bar http://www.alixixi.com/web/a/
<table cellspacing=0 cellpadding=0 bgcolor= #FFFFFF width=40% id=p><tr><td>
<table cellspacing=0 cellpadding=0 bgcolor= #0000FF height=18 http://www.alixixi.com/web/a/
Id=q><tr><td></td></tr></table></td></tr></table>
</center>
<script language=javascript>
var R = 0; Load ();
function Load () {R = R + 2; Q.style.width = R +%; Time= settimeout (Load (), 50);
if (R > MB) {cleartimeout (time); P.style.width=0}}
</script>
27 Full Screen
<script language=javascript>
window.open (' index.asp ', ', ', ' fullscreen=1 ');
</script>http://www.alixixi.com/web/a/
21. Background picture scrolling http://www.alixixi.com/web/a/
<body scroll=no background=images/bg.jpg link= #00FF00 alink= #FF0000 vlink= #00FF00 http://www.alixixi.com/web/a/
bgcolor= #000080 topmargin=8>
<script language=javascript>
var backgroundoffset = 0;
var bgobject = eval (' document.body ');
function SCROLLBG (maxSize) {backgroundoffset = Backgroundoffset + 1;
if (Backgroundoffset > maxSize) backgroundoffset = 0;
bgObject.style.backgroundPosition = 0 + backgroundoffset;}
var Scrolltimer = Window.setinterval (SCROLLBG (410), 20)
</script>http://www.alixixi.com/web/a/
22. Web pages will not be cached http://www.alixixi.com/web/a/
HTML 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>.
ASP Web page
Response.Expires =-1
Response.ExpiresAbsolute = Now ()-1
Response.CacheControl = No-cache
PHP Web page
Header (Expires:mon, June June 1997 05:00:00 GMT;
Header (Cache-control:no-cache, must-revalidate;
Header (pragma:no-cache;http://www.alixixi.com/web/a/
23. Minimize, Maximize, close windows http://www.alixixi.com/web/a/
<object ID=HH1 classid=clsiddb880a6-d8ff-11cf-9377-00aa003b7a11>
<param Name=command value=minimize></object>
<object ID=HH2 classid=clsiddb880a6-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 () >http://www.alixixi.com/web/a/
24. Determine the origin of the previous page http://www.alixixi.com/web/a/
ASP page:
Request.ServerVariables (Http_referer
java Script:
document.referrerhttp://www.alixixi.com/web/a/
25. The cursor is the last http://www.alixixi.com/web/a/that stops at the text box
<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 () >http://www.alixixi.com/web/a/
JavaScript several forms of common validation scripts: http://www.alixixi.com/web/a/
Only numeric http://www.alixixi.com/web/a/can be entered
<input onkeyup= "Value=value.replace (/[^\d]/g,") "
Onbeforepaste= "Clipboarddata.setdata" (' Text ', Clipboarddata.getdata (' text '). Replace (/[^\d]/g, ') ">
Enter to move the cursor to the next input box http://www.alixixi.com/web/a/
<input > <br>http://www.alixixi.com/web/a/
Can only be Chinese http://www.alixixi.com/web/a/
<input onkeyup= "Value=value.replace (/[-~]/g,") "> <br>http://www.alixixi.com/web/a/
Shielding Input Method http://www.alixixi.com/web/a/
<input style= "ime-mode:disabled" > <br>http://www.alixixi.com/web/a/
Only English and digital http://www.alixixi.com/web/a/can be entered
<input onkeyup= "Value=value.replace (/[\w]/g,") "
Onbeforepaste= "Clipboarddata.setdata" (' Text ', Clipboarddata.getdata (' text '). Replace (/[^\d]/g, ') "
> <br>http://www.alixixi.com/web/a/
Can only display, cannot modify http://www.alixixi.com/web/a/
<input readonly value= "can only be displayed, cannot be modified" >
Prohibit copy selection, etc. ....... http://www.alixixi.com/web/a/.
<script language= "JavaScript" type= "Text/javascript" >http://www.alixixi.com/web/a/
Double-click the mouse to scroll the screen code http://www.alixixi.com/web/a/
var Currentpos,timer;
Function Initialize ()
{
Timer=setinterval ("ScrollWindow ()", 30);
}
function SC ()
{
Clearinterval (timer);
}
function ScrollWindow ()
{
Currentpos=document.body.scrolltop;
Window.Scroll (0,++currentpos);
if (Currentpos!=document.body.scrolltop)
SC ();
}
Document.onmousedown=sc
Document.ondblclick=initialize http://www.alixixi.com/web/a/