HTML getting started Tutorial: open a new window and pop-up window

Source: Internet
Author: User

I. Basic changes

Parameter description:

Window. open command to pop up a new window;

"Page.html" indicates the file name in the pop-up window;

"Newwindow" refers to the name (not the file name) of the pop-up window. It is optional and can be replaced by "null;

100 window height;

Width = 400 window width;

Top = the pixel value between the 0 window and the top of the screen;

Left = 0 the pixel value between the window and the left of the screen;

Toolbar = no indicates whether to display the toolbar. yes indicates display;

Menubar and scrollbars indicate the menu bar and scroll bar.

Resizable = no: whether to change the window size. yes: yes;

Location = no indicates whether the address bar is displayed. yes indicates yes;

Status = no whether to display the information in the status bar (usually the file has been opened), yes is allowed;

2. Pop up a full screen window

Add fullscreen

3. Open the same window as F11.

Add channelmode

4. Open a window without a title bar (no title, minimum, maximum, or close button)

What is the effect? What if I set resizable to 0 scrollbars = no?

5. No window for maximizing the button

In fact, just like the "About Us" Window of the software, the following is a conversation.

Window.

ShowModalDialog () and showModelessDialog ()

1. Use showModalDialog ()

  Www.bkjia.com

2. Use showModelessDialog ()

  Www.bkjia.com

The difference between showModalDialog () and showModelessDialog () is that the window opened by showModalDialog () (mode window for short) is placed on the parent window and must be closed.

Close to access the parent window (we recommend that you use it as little as possible to avoid dislike); showModelessDialog ()

(No Mode window). You do not have to close the window or access the window opened in the parent window.

Now I will describe some parameters here.

DialogHeight: the height of the window in the iHeight Setting dialog box.

DialogWidth: iWidth: Set the window width in the dialog box.

DialogLeft: left position in the dialog box relative to the upper left corner of the desktop.

DialogTop: the top position in the window of the iYPos Setting Dialog Box relative to the top left corner of the desktop.

Center: {yes | no | 1 | 0} specifies whether to center the dialog box on the desktop. The default value is "yes ".

Help: {yes | no | 1 | 0} specifies whether the context-sensitive help icon is displayed in the dialog box. The default value is "yes ".

Resizable: {yes | no | 1 | 0} specifies whether the dialog box window size is variable. The default value is "no ".

Status: {yes | no | 1 | 0} specifies whether the status bar is displayed in the dialog box. For non-mode dialog box windows, the default value is "yes"; for mode dialog box windows, the default value is "no ".

6. n windows are displayed.

This is simple. You only need to execute window. open () n times. Of course, you must give different names to each window. Also, set left and top to avoid overlap.

7. The window will not pop up after refresh

We can use cookies to control it.

First, add the following code to the HTML area of the Home Page:

Then, use it (not openwin, but loadpop !) Replace the original sentence on the home page. You can refresh the page or enter the page again, and the window will no longer pop up.

8. Enable the pop-up window to adapt to the image size

Many times we need to provide this function to visitors: When a visitor clicks a thumbnail on the page, the full-size image corresponding to the thumbnail will be displayed in a new pop-up window for visitors to view.

The simplest way to implement this function is to use the following HTML code to create an image link:

The marked href attribute specifies the URL of the full-size image, and the target attribute is set to _ blank to display the image in a new window; The Marked src attribute specifies the URL of the thumbnail.

If you want to control the appearance of a window that displays a full-size image (for example, if you want the height and width of the window to match the size of the full-size image), you can call the window. open method. This method receives three parameters, respectively specifying the URL, window name, and window properties of the file to be opened. You can specify the window height and width in the window property parameters, whether to display the menu bar and toolbar. The following code displays a full-size image in a window without a toolbar, address bar, Status Bar, and menu bar. The width and height are 400 and 350 respectively.

This raises a question. If all full-size images have a uniform size (for example, 400x350 ), the above Code applies to all the thumbnail links (only the full-size image file pointed to by the href attribute is different ). However, if the size of the full-size image is not uniform and the above code is used, we need to first obtain the size of each full-size image, and then in the window of the window. open Method

In the feature parameters, the height and width values are set to the correct values. When the number of images is large, the efficiency is obviously too low. Is there a permanent way to enable the pop-up window to automatically adapt to the size of the image to be displayed? Through research, we found that we can use the Image object in DHTML to achieve our goal. The Image object can dynamically load the specified Image and obtain the size of the loaded Image by reading its width and height attributes, in this way, you can set the size of the pop-up window to adjust the image size. The following is the implementation code:

In use, place the above Code in the tag center of the webpage document, and then call the OpenFullSizeWindow function in the Click Event of the link. The above Code passed the test in IE 5. x-6.0.

9. Flexible HTA window

For a brief introduction, the full name of HTA is HTML Application, which is translated as an HTML Application. You only need to simply use it. even if an hta file is created to store HTML pages with the extension, we use HTA to compile a window and save the following code. open the hta file in a browser.

  Read HTML Chinese manual: http://www.bkjia.com/a/manual/html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.