left Supported by version 4 browsers and above, this sets how far removed the window appears from the left of the screen. Again, you'll have no joy with percentages. height Defines the height of the window in pixels. Whichever you choose to use, all of your options go into the same quoted string, with commas between the values, and no spaces are allowed between them. When you define any of them, the remaining Boolean values (which can be true/false or yes/no or 1/0) are all set to false/no/0. You have a number of options for the third argument. The name we specify will be used to open further pages into this new window. Some browsers prohibit the opening of pages on another server for security reasons, so test your script. The url we're using is passed to the function when we call it, so that this function can be used for any number of different popups (though the height/width and other options will always be the same unless you modify the function to take more arguments). This method then takes three arguments: the address of the new page, the name of the window, and a third argument which can hold some, few, or less optional attributes of the window, such as the height and width which I've defined in this case. We load the new window (created with the window.open() method) into a variable. The HTML for that link simply called the function with the URL of the page we want to pop up as an argument. This will open the specified url in a new, downsized window, the dimensions of which are set down in the function. We're simply defining a new JavaScript function, which we can pass different URLs to each time. To get a rudimentary page to pop up off your main page on command from a link, you'll need the following JavaScript code and JavaScript link: However, if you want more control over this new window, you will need to use some JavaScript code. This will open the new page in a new window, and is perfect for most people’s needs. Opening new windows is easy enough in plain old HTML, using the target attribute on your links, like so:
0 Comments
Leave a Reply. |