The second, optional[1] argument to the open() method discussed earlier is a name for the newly created window. By giving a top-level browser window a name, we've seen that you can look up a reference to that window by calling the open() method again. But you can also refer to a window by name in another way: by specifying the window name as the value of the TARGET attribute of the <A>, <MAP>, and <FORM> tags. What this does is tell the browser where you want the results of activating a link, clicking on an image map, or submitting a form to be displayed. For example, if you have two windows, one named "table_of_contents" and the other named "mainwin", then you might have HTML like the following in the "table_of_contents" window:
<A HREF="chapter01.html" TARGET="mainwin"> Chapter 1, Introduction </A>
[1] This argument is not optional in Internet Explorer 3.0.
Since frames are a type of window, frames can also have names that can be used with the TARGET attribute. You specify a name for a frame with the NAME attribute of the <FRAME> tag that creates the frame.
There is even another reason to give names to frames. We've seen that every Window object has a frames[] array that contains references to each of its frames. This array contains all frames in a window (or frame) whether or not they have names. But if a frame is given a name, then a reference to that frame is also stored in a new property of the parent Window object. The name of that new property is the same as the name of the frame. Therefore, if you create a frame with HTML like this:
<FRAME NAME="table_of_contents" SRC="toc.html">
parent.table_of_contents
parent.frames[1]
Much of the discussion in this section has been about the TARGET attribute and other features of HTML rather than about JavaScript itself. If windows can have names, then it is logical to expect that Window objects have a JavaScript property that contains the window name. This is indeed true. The name property of any Window object contains the name of that window. In Navigator 2.0, this property is read-only. In Navigator 3.0, however, you can set this property, thereby changing the name of a window or a frame. One common reason to do this is to set the name of the initial browser window. When Navigator starts up, the initial window has no name, and so it cannot be used with the TARGET attribute. If you set the name property of the window, however, you can then use that name in TARGET attributes.
file: /Techref/language/java/script/definitive/ch11_04.htm, 7KB, , updated: 2019/10/14 15:00, local time: 2024/11/22 13:43,
18.218.38.67:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/language/java/script/definitive/ch11_04.htm"> [Chapter 11] 11.4 Window and Frame Names</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.