spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

JavaScript Tip of the Week 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:
    if (navigator.javaEnabled()) <-- determine if java is enabled
    {
    var toolkit = java.awt.Toolkit.getDefaultToolkit();
    var screen_size = toolkit.getScreenSize();       
    width = screen_size.width; 
    height = screen_size.height;
    }
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?)

Source

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint