|
|
The whip and rope are necessary, Else he might stray off down some dusty road. Being well trained, he becomes naturally gentle. Then, unfettered, he obeys his master. |
| What is the sound of one hand clapping? |
|---|
| Several decades ago, I was reading about Zen and pondering this koan. My then three year old daughter was on the other side of the room on the floor playing with blocks. Suddenly, she burst into laughter, brimming with delight at the structure she’d created - unaware that I was even in the room. |
Creating Windows in JavaScript:
This page you're viewing was created by a JavaScript function on the main page that looks like this:
/* Load a page into a sized Browser window */
function loadSession(page){
var winSize;
if (navigator.appName.toLowerCase() == 'netscape'){
winSize = "scrollbars=yes,";
winSize+= "status=yes,width=600,height=400"}
else {winSize = "menubar=yes,scrollbars=yes,";
winSize+= "status=yes,width=600,height=400"}
msg = open(page,"Session",winSize)} |
| Windows, Windows, Windows: |
|---|
| We're about to start throwing windows all over the screen. Be sure to close the ones from each example before going to the next. Otherwise, it's going to get beyond messy. The key icon on this page will let you see the functions that create the windows. |
| Pop-up Window Examples |
|---|
The four windows illustrate the amount of control JavaScript gives you over browser windows. Windows 1 and 2 are self explanatory.
Window 3 is something different. The browser window contains a page written completely by a JavaScript function.
Consider the code on the right. It completely defines an html page. Now look at the function windowThree().
You can quickly see that the illustrated web page is embedded in the JavaScript.
Window 4 is also a JavaScript written page, but adds the ability to communicate from 'parent' window to 'child' window and vice versa.
document is a 'property' of the Windows Object.
It's also an object itself - it's the part of the window you 'write on'.
In Windows 3 and 4, we use several methods of the Document Object.
There is great power here. We'll not elaborate on the details. You can easily create communicating dialogs, all sorts of web browsing utilities, text and graphics displays, etc. We'll show some in the next tutorial.
|
|
|
|
|