JavaScript Tip of the Week for September 9, 1996: Much Ado About LiveConnect | 4

for September 16, 1996: JavaScript and Java

One of the most useful things in LiveConnect is the way it allows JavaScript to interact with Java. You now have ability to access Java's methods and classes through JavaScript. Using this LiveConnect feature with Java, I can tell that your
Using that information, I can then create a horizontal rule that fits the width of your screen.
Detecting the screen size and then changing the look of the page to fit that size is actually an easy task. First, call the java classes that allow you to determine the screen size:

This code takes Java's getScreenSize() function gives it value to variable screen_size. Then the height and width properties of screen_size are given to variabes height and width, respectively, for ease of use. Finally, using the new JavaScript evaluation feature, a horizontal rule the 35 pixels less than width of the screen is created:

<IMG SRC = "rule.gif" HEIGHT = 9 WIDTH = "&{width - 35};">

This is just the tip of the iceberg, in the future, there will be tips that deal with Java, JavaScript, and Plug-ins together in harmony. (What a nice thought, isn't it?)