|
|
The moveTo Command |
| Most commands in JavaScript are pretty self-explainatory; the MoveTo command moves the window to a new place. |
| You would tell the window to move to a new place by typing window.moveTo(xcoordinate, ycoordinate); |
|
The window object is an object that reffers
to, well, the window itself. You can also reffer to the window that you want to move by it's name. |
| The moveTo command tells self to move to location xcoordinate and ycoordinate. |
The window.open command |
| The window.open command opens a window! |
| This is a really useful tool; many sites use the window.open command to create their own user defined windows without having to do a snippet of HTML. |
|
The syntax, or the correct use of the code,
is as follows(any text that is bold is optional): |
|
So let's say that you wanted to open tutorialdojo.com in a new window. All you'd need to type is "window.open('http:\\www.tutorialdojo.com');" |
| The only thing you sent to the open command was the URL, but you didn't even need to send that to the function. |
| To pop a blank page up, you would type "window.open();". |
| To pop up a page that was named Jon, you simply type "window.open('http:\\www.tutorialdojo.com','Jon');". |
| If you want to get fancy you can edit what's known as the chrome of the user's newly made window. |
| The chrome of a window is the little things that the browser has (i.e.: navigation buttons, address bar, menu, etc.). |
| You would make a window that has no menubar by typing "window.open('http:\\www.tutorialdojo.com\','Jon','menubar=no');". |
| Conversely, typing yes instead of no insures that they have a menubar. |
| Other things you can type include, but are not limited to statusbar, addressbar, toolbar, and fullscreen . |
| The last parameter you can send to the open command is the replace parameter. |
| The replace parameter tells the browser whether it's okay to replace the window's content if it already exsists with that name. |
| You can only use true and false with this one. |
|
Yet another, and final, example of the window.open
command is as
follows: window.open('http:\\www.tutorialdojo.com","Jon","statusbar=no",false); |
| This final example would open a new window named Jon, that has the URL of tutorialdojo.com, no statusbar, and will not replace the window if it already exists--Whew! |
The resizeTo Command |
| The resizeTo command resizes the window. |
| It is used just as the moveTo command is used. |
|
Allright... here's another
example: |
| Now, screen.width and screen.height are actually unchangable variables that represent the screen's width and height. |
|
|
| Now we're getting into the fun stuff! |
|
|
|