Recently, I made a jsp webpage to open an Internet Explorer without menu bar. I thought of using window.open to open it. But found that if the previously opened form was not closed,When a form is opened, a new form is opened on a form that was not previously closed,The previous window is replaced.After searching the information and testing, it is found that if the specified form name and the current form have the same name when opening the form, it will be opened on that form.For example:

window.open ("view_svg.jsp?ukey =<%= ukey%>&itemid =<%= itemid%>&charset=utf-8", "newwindow", "height =" 100%",, toolbar=no, location=no, directories=no, menubar=no, scrollbars=no, resizable=no, status=no ");

Each window opened in this way is opened in a window named newwindow.

Note:The name of the form is different from the title.

1.window.open (urlstr, "_ blank", "");

The _blank parameter indicates that a new window is opened.

2. You can also use the following method to make the form open differently each time.

random rd=new random ();
int i=rd.nextint (100) +1;
string ranstr=string.valueof (i);
<script type="text/javascript">
function doclose () {
 var currnwin=window.open ("view_svg.jsp?ukey =&%;uke =%>&itemid =<%= itemid%>&charset=utf-8", "<%= ranstr%>"," height="100%", width="100%", toolbar=no, location=no, directories=no, menubar=no, scrollbars=no, resizable=no, status=no ");
 window.close ();
 window.focus ();

The following is to introduce you to open a new window using javascript window.open

The open () method looks for an existing or newly created browser window.


window.open ([url], [window name], [parameter string])

Parameter Description:

url:optional parameter,The URL or path of the web page to display in the window.If this parameter is omitted,Or its value is an empty string,Then the window will not display any documents.

Window name:optional parameter,The name of the window that was opened.

1. The name consists of letters, numbers, and underscore characters.

2. "_top", "_blank", "_selft" are names with special meaning.

_blank:Show landing page in new window

_self:Show landing page in current window

_top:Display the landing page in the upper window of the frame page

3. Only one window of the same name can be created,To create multiple windows, the name cannot be the same.

4.name cannot contain spaces.

Parameter string:optional parameter,Set window parameters,Each parameter is separated by a comma.

Parameters Table:

For example:open website, size is 300px * 200px, no menu, no toolbar,No status bar,Window with scroll bar:

<script type="text/javascript">window.open ("http://www.google.com", "_blank", "width=300, height=200, menubar=no, toolbar=no, status=no, scrollbars=yes ")

Friendly reminder:We must pay attention to browser compatibility issues here.

  • Previous Teach you how to solve the problem of plugins not working after XCODE upgrade
  • Next Function expressions and function declarations in JavaScript and function declarations differ from function expressions