HTML Target Attribute
You can use the HTML anchor tag and the target attribute to open a new window. However, the target attribute is being phased out. In spite of this, the HTML method is still popular. Here is the code. The attribute/value pair of target="_blank" is what causes the newpage.html to open in a new window.
The open command has four optional parameters that you can use to control the new window. Each parameter is placed between single quotes and the parameters are separated by a comma. All of the parameters are grouped together between opening and closing parenthesis. We will discuss the three parameters that are used most often.
The url parameter sets the url address for the web page that will be loaded into the new pop-up window.
The name parameter gives the pop-up window an ID name. You can use anything here that you want from example to Sam.
In the example above, we set the width and height features to 400 pixels each. You will also notice that these features are placed together between single quotes. Each feature is followed by an equal sign. After the equal sign is the value for that feature. Each feature/value pair is separated by a comma only (NO spaces). The config= in front of the 'group of features' is optional.
Besides the width and height, there are many more features that you can use to control the new window. The width and height features are set in pixels but the other features are set to yes or no. You can also use 1 for yes or 0 for no. The value of yes will cause the element of be placed on the web page. Of course if the value is no, the element is left off of the page. The chart below summarizes the most popular features.
This site needs an editor - click to learn more!
Editor's Picks Articles
Top Ten Articles
Content copyright © 2022 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.