magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 1996 > 10 > Features  

Extending JavaScript with Java

Using JavaScript to Interface with Java Applets

By Kamran Husain

Netscape Navigator 3.0 allows JavaScript applications to work and interact with Java applets. A much more powerful language than JavaScript, Java includes features such as support for sockets and graphics. However, a Java applet controls only its own space on an HTML page, not the page itself. JavaScript, on the other hand, makes it easy to create your Web pages and dictate the format and layout of a page using frames and documents. (See "Sharing Data Between Web-Page Frames Using JavaScript," by Tom Tessier, Dr. Dobb's Journal, May 1996.)

In this article, I'll show how to include applets in HTML code so that JavaScript can use them as objects, how to write applets that allow JavaScript applications to control the values of variables within applets and, finally, how to write JavaScript applications that work with Java applets.

Interfacing with Java

By manipulating a Java applet's global variables, a JavaScript program can influence its behavior. Here, we will adjust the visual display of a gauge applet. The ideas presented here can be extended to modify other aspects of a Java control using JavaScript. For example, you could get an Internet address from within a JavaScript application and then open a socket to a server from within an applet.

Combining Java applets with JavaScript code somewhat parallels Microsoft's Visual Basic code with OCXs (or the older VBXs) to put together a complex application.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2