Javascript| Problem | show
Return to a fixed page:
function BK (strURL)
{
Window.location.href=strurl
}
BK ("a.jsp")
Open a page and display it in full screen
<script language= "JavaScript" >
<!--Begin
if (this.name!= ' fullscreen ') {
window.open (location.href, ' fullscreen ', ' fullscreen,scrollbars ')
}
End-->
</script>
<a href= "JavaScript:window.close (self)" > return to normal effect display </a>
<script language= "JavaScript" >
<!--
window.open ("url (such as http://www.webjx.com)", "(Window name) 123", "height=170, width=300, Toolbar=no,menubar=no, Scrollbars=no, Resizable=no, Location=no, Status=no, top=100 ");
-->
</script>
Note:
The URL represents the address of the pop-up window
Height stands for pop-up window heights
Width stands for pop-up window widths
Toolbar represents the toolbar, no means there is no toolbar, yes is a toolbar
MenuBar represents the menu bar, no means that no menus are displayed, and the user can use Yes
ScrollBars represents a scroll bar, no indicates no scroll bar, yes is a scroll bar, or you can use auto
Resizable represents whether a pop-up window can be scaled
Location represents the Address bar
Status stands for a closed state bar
Top represents the distance of the window from the upper part of the browser
JavaScript: Full fault tolerance and automatic browser maximization
Instant processing of error codes
Our JavaScript code is sometimes flawed by our negligence, so that the user
How do you handle this situation when browsing pops up with annoying error-tip frames? Here are two common
See method:
(1) Complete fault tolerance
That is, when the user browses the page containing the error code, ignore all the errors. The code is as follows:
;
〈script〉
function Killerr () {
return True
}
Window.onerror=killerr
〈/script〉
Although it can cover up errors, avoid pop-up error balloon, but the program still does not execute correctly, the following describes another
Processing methods.
(2) Feedback error message
That is, when the error code appears, automatically pop-up our pre-designed feedback window, the purpose is to user only Jane
A single click of the mouse can send feedback to your designated mailbox, of course, the content of the feedback window we
Can modify the design arbitrarily. The code is as follows:
〈script〉
function ErrorInfo ()
{
Errorwin=window.open (″″,″″,″width=20,height=120″)
Errorwin.document.write (′〈title〉 script error report 〈/title〉〈center〉 this page
Face found a script run error, please 〈a href=″mailto:lhy@cenpok.net″〉 notify 〈/a〉
Administrator. 〈br〉〈form〉〈input Type=″button″value=″ Closes the window ″oncli
Ck=″window.close () ″〉〈/form〉〈/center〉′)
Errorwin.document.close ()
Errorwin.document.bgcolor=″#ffffff″
return True
}
Window.onerror=errorinfo
〈/script〉
Optimizing the Browsing window
Using this code, when the user opens your page, the browser window automatically expands to the maximum available space
(not full screen), is not very professional?
The following code is placed between 〈head〉〈/head〉:
〈script language=″javascript″〉
〈!--function Winfix () {
if (document.layers) {
width=screen.availwidth-10;
height=screen.availheight-20;
} else {
var width=screen.availwidth-2;
var height=screen.availheight;
}
Self.resizeto (width, height);
Self.moveto (0, 0);
}
--〉
〈/script〉
The following code is placed in the 〈body〉tag:
〈body Onload=″winfix () ″〉
<script language= "JavaScript" >
Resize_window
if ((screen.width = = 1024) && (screen.height = 768)) {
RESIZE_WINDOWX = 1024;
Resize_windowy = 768;
Self.resizeto (resize_windowx,resize_windowy);//resize_windowend
}
Else ((Screen.width > 1024) && (Screen.height > 1000)) {
Document.body.clientWidth = 1280;
Document.body.clientHeight = 1024;
Self.resizeto (document.body.clientwidth,document.body.clientheight);//resize_windowend
}
Document.body.clientWidth; Document.body.clientHeight
</script>
<script language= "JavaScript" >
<!--Begin
if ((Screen.width = = 640) && (screen.height = 480)) {
self.location.href= ' 640*480.htm '
}
else if (Screen.width = && (screen.height = 600)) {
self.location.href= ' 800*600.htm '
}
else if ((screen.width = = 1024) && (screen.height = 768)) {
self.location.href= ' 1024*768.htm '
}
else {self.location.href= ' else.htm '
}
End-->
</script>
The operation between WINDOW.OPENR open child parent windows is not the same as the frame, and there is a opener between the child window and the parent window. The source window to access the child window is to be manipulated by its handle. The following small examples would like to help beginners learn more about their operations.
Test.htm
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "generator" content= "Microsoft FrontPage 4.0" >
<meta name= "ProgId" content= "FrontPage.Editor.Document" >
<title> Child parent Window Actions </title>
<body>
<script>
var win=null;
Function op () {
Win=window.open ("About:blank", "Win", "width=200,height=200");
Win.document.write ("<input type= ' button ' value= ' Close parent window ' >");
Win.document.write ("<input type= ' button ' value= ' Refresh your window ' >");
}
</script>
<input value= "Open Window" type= "button" ><input type= "button" value= "Minimize" ><input type= "button" value= "Maximize" ><input Type=button value= "Close child window" ><input Type=button value= "Refresh child window" ><input type= button "Value=" Look at the size of the child window >
</body>
Web page automatically closes for a certain time
<script Id=clienteventhandlersjs language=javascript>
Window.opener = null;
</script>
<body bgcolor= "#fef4d9" >
<title>123</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<script>
<!--
function Omiga_window () {
window.open ("full_window.htm", "" "," Fullscreen,scrollbars ")
}
-->
</script>
<body onblur= "focus (); closes. Click (); "Scroll=" No >
<object id=closes type= "Application/x-oleobject" classid= "Clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" >
<param name= "Command" value= "Close" >
</object>
<p> </p>
<p> </p>
Fullscreen!
</body>
<script language=″javascript″〉
〈!--function Winfix () {
if (document.layers) {
width=screen.availwidth-10;
height=screen.availheight-20;
} else {
var width=screen.availwidth-2;
var height=screen.availheight;
}
Self.resizeto (width, height);
Self.moveto (0, 0);
}
--〉
〈/script〉