JavaScript Effects Instance 001-Open a new window to display ad information

Source: Internet
Author: User

Example 001 open a new window display AD message Instance descriptionThis example pops up an ad dialog box each time the window is loaded. Technical EssentialsThis example mainly applies the JavaScript window object.
Common Methods for Window objects
Method Description
Alert () Pop up a warning dialog box
Confirm () Displays the specified string in the confirmation dialog box
Prompt () Pop up a prompt dialog box
Close () Close the referenced window
Focus () Place the referenced window in front of all open windows
Open () Opens a new browser window and displays the document referenced by the URL or name, and sets the properties of the Create window
Resizeto (x, y) Set the size of the window
Resizeby (offsetx,offsety) Sets the size of the window according to the specified amount of displacement

Use the Open () method of JavaScript to open the browser window.The syntax for opening Windows using the Window object is formatted as follows.
Windowvar = window.open (url,windowname,location);
The parameters are described as follows:1.WindowVar: Handle to the currently open window. 2.url: The URL of the target window. 3.windowname:window: The name of the object. 4.location: Set the window properties.
Optional parameters for setting the window properties
Properties Description
Width Width of window
Height Height of window
ScrollBars Whether scroll bars are displayed
Resizable Sets whether window size is fixed
Toolbar browser toolbar, including back and forward buttons, etc.
MenuBar The menu bar, which generally includes files, edits, and other items
Location The locator area, also called the Address bar, is the browser text area where you can enter a URL
Direction Update Information button
implementation Process(1) First create a page to pop up the ad message, and add the advertised information to the page. new.html
(2) on the index.html page, write the JS code implementation function
Index.html
Note: The content of the style tag is the knowledge of CSS, and we focus on the content within the script tag.  So this example of ours is done. 



JavaScript Effects Instance 001-Open a new window to display ad information

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.