Previous Example-|-Next Example-|-Return to Chapter Listing

Example 13.8:
LiveConnect: Using the Java Console

[This example works with Netscape Navigator 3 and 4. It won't work with Internet Explorer 3, because that browser doesn't have a Java Console.]

This example shows how to send text to the Java Console. Select Options|Show Java Console (in Navigator 3) or Communicator|Java Console (Navigator 4) to open the console. Then type some text and click the button.


We have this in the HEAD: <SCRIPT language="Javascript"> <!-- function writeConsole(s) { java.lang.System.out.println(s) } //--> </SCRIPT> Then this form in the BODY: <FORM name="consoleForm"> <INPUT type="text" name="message" size=32> <INPUT type="button" value="Send text to the Console" onclick="writeConsole(this.form.message.value)"> </FORM>
Previous Example-|-Next Example-|-Return to Chapter Listing