
Home
|


JAVA SCRIPT
Examples of opening window with javascript
|
Here's the first line:
<a href="#"
onClick="window.open('javascript_window_1.html','javascript_1');">Here's
a window named javascript_1</a>.
| When
you click on this link, a new window called javascript_1
gets opened and the HTML page javascript_window_1.html
gets put into the window. Because the features parameter
is optional, you can just leave it out. This will give you the
default window you would have gotten if you'd used a targeted href,
as in the previous page.
Notice that I put the call to open the window in an onClick.
You don't have to put window.open() calls inside an onClick,
it was just convenient to do so in this example. You'll see
examples of window.open() inside <script>
tags soon.
The second link is almost exactly like the first link. It just
opens a window with a different name and loads in a different HTML
page:
|
<a href="#"
onClick="window.open('javascript_window_2.html','javascript_2');">Here's
a window named javascript_2</a>.
| The
third link sticks a new HTML page into the first window. This
works because the third link opens a window with the same name as
the first window: javascript_1.
|
<a href="#"
onClick="window.open('javascript_window_3.html','javascript_1');">Here's
another HTML page going into javascript_1</a>.
|
 |