lecture 8: more objects
You can pass quite a lot of information to a browser using JavaScript events. For instance, you can get it to open new windows and specify the size of those windows precisely. Have a look at these two links, which have onclick events coded into them as noted below. You can see how they open windows in different places and of different sizes - and for good measure have no toolbars.
The full code for one of these links is as follows: this also appears on your handout. It is very important that you note the following: with long objects like this they must be typed without line breaks in the code. It looks as if these lines have breaks in them, but I've done that to make them fit on this screen. When you type them, even if Notepad breaks a line for you, don't break it yourself by typing Return. Type it all in one long string of characters.
<a href="#startcontent" onClick="window.open('colombia.html','','width=600, height=400,left=100,screenX=100,top=100,screenY=100')">Some facts about Colombia</a>
It's time to talk in a little more detail about what all this means. We are reaching the limits of what can be sensibly done with JavaScript events, and are heading into the territory of actual scripts which can give a series of instructions to the browser.
|