JavaScript special effect instance 001-open a new window to display the advertisement information, javascript001-

Source: Internet
Author: User

JavaScript special effect instance 001-open a new window to display the advertisement information, javascript001-
Instance 001 the advertisement information is displayed in a new window. instance Description: each time the window is loaded, an advertisement dialog box is displayed. Technical points this example mainly applies the window object of JavaScript.

Common Methods for window objects
Method Description
Alert () A warning dialog box is displayed.
Confirm () The specified string is displayed in the confirmation dialog box.
Prompt () A prompt dialog box is displayed.
Close () Close the referenced window
Focus () Place the referenced window in front of all opened windows
Open () Open the new browser window, display the document referenced by the URL or name, and set the properties of the window to be created.
ResizeTo (x, y) Set the window size
ResizeBy (offsetx, offsety) Set the window size according to the specified displacement

You can use the open () method of JavaScript to open a browser window. The syntax format of window object opening is as follows.
WindowVar = window.open(url,windowname,location);
Parameters are described as follows: 1. WindowVar: the handle of the window currently opened. 2. url: the URL of the target window. 3. windowname: window: name of the object. 4. location: Set window properties.
Optional parameters for setting window properties
Attribute Description
Width Window width
Height Window height
Scrollbars Display scroll bar?
Resizable Set whether the window size is fixed
Toolbar Browser toolbar, including the back and forward buttons
Menubar Menu Bar, which generally includes files, edits, and other entries
Location Location Area, also known as the address bar, is the address area of the browser that can enter the URL
Direction Update information button
Implementation Process (1) first, create a page for pop-up ad information, and add the ad information to be promoted to the page. New.html
<Html> (2)write JS Code implementation functions on the index.html page

Index.html
<Html> Note: The content of the style label is css. We focus on the content in the script label. In this way, our instance is ready.




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.