|
To open a new window, you will need to use yet another ready-made JavaScript function. Here is what it looks like: window.open('url to open','window name','attribute1,attribute2') This is the function that allows you to open a new browser window for the viewer to use. Note that all the names and attributes are separated with a comma rather than spaces. Here is what all the stuff inside is:
Window Attributes Below is a list of the attributes you can use:
All right, here's an example code for opening a new window: <FORM> <SCRIPT LANGUAGE = JavaScript> function OpenWindow() </SCRIPT>
Yes, you got a 400 by 200 window with some writing in it! Some Important Rules Before we move on, we need to make note of some things so you won't go insane like I did trying to get this to work right!
A New Browser Window Okay, enough rules. Let's look at the code that makes a completely new browser! Basically, you just use yes for all of the attributes. Here is the code: <FORM> Give it a try, this window has all the features!
Remember, keep everything on one line....one really, really long line! I just put the sample code on new lines so you wouldn't have to scroll forever to read everything........and your printer won't go crazy now either! Set the Window Position There is another set of options you can use to set the position of the new window on the viewers, but it only works with NS4+ and IE4+:
Great, but how do you decide which commands to use if there are different ones for each browser? In this case, you can use both sets of commands- the browser will ignore the set it does not recognize. The example below will give you a new window 0 pixels from the left and 100 pixels from the top of your screen: <FORM>
Now, that is a lot of work- but you can now customize a new window for your viewers!
|
| menubar | This is the row of functions that appears on most software applications. Normally it includes File, Edit, and a few other items. |
| status | This is the message bar at the bottom of your window. When you move your mouse over an HTML link, the URL appears in the status bar. |
| scrollbars | scrollto() methods are available |
| width | size of your window |
| height | size of your window |
| screen.height | where on your desktop the window opens |
| screen.width | same as above |
| toolbar | |
| location |
The text area of a browser into which you can type URLs |
| copyhistory | Do we want them to be able to use the "back" button?? |
| directories | Netscape has those folders -- "what's new", etc. - to show or not to show |
| oncontextmenu | <BODY oncontextmenu="return false" > |
| document.body.onclick | |
| fullscreen | "chromeless" window -- This is worth checking out |
<script language=javascript> var var_posw = (screen.width + 300)/2;
var var_posv = (screen.height + 200)/2;
window.open('home.htm','HomeTitle','resizable=yes,width=600,height=400,left='
+ var_posw + ',top=' + var_posv);
</script>
Another option you have is to display these options in your body tag like a style
<body scroll=no >