This example illustrates how you can use JavaScript to control the
applet. Here we are using form buttons but there are lots of other
possibilities:
- Put the applet in one frame and let the documents in the other
frame call the applet to make it view relevant information.
- Use the applet to view instruction how to fill in a form. The
message could change when the user enters a field.
- The main applet message could be used for showing the latest news,
while the temporary message gives details about where the user will
get when he clicks on a menu item.
Applet code
<applet code="ET_TextScroll.class" name="scroller"
width="170" height="110">
<!-- Border color. No border if not specified. -->
<param name="BorderColor" value="000000">
<!-- The color of the background and the text.-->
<param name="BGColor" value="3f4e4e">
<param name="TextColor" value="ffffff">
<param name="HeaderColor" value="ff9955">
<param name="URLColor" value="ffff99">
<param name="URLOver" value="ff8844">
<param name="URLClick" value="ff0000">
<!-- Url underline -->
<param name="URLUnderline" value="true">
<!-- Fonts -->
<param name="TextFont" value="TimesRoman">
<param name="TextStyle" value="plain">
<param name="TextSize" value="14">
<param name="HeaderFont" value="Ariel">
<param name="HeaderStyle" value="bold">
<param name="HeaderSize" value="15">
<!-- Geometry -->
<param name="Margin" value="5">
<param name="Align" value="Left">
<!-- Scroll speed -->
<param name="ScrollDelay" value="30">
<param name="ScrollMove" value="15">
<!-- The text message is read from this separate file -->
<param name="InputFile" value="TextInput.txt">
</applet>
The source shown above is not exactly the same as for the example,
as it assumes that the class files are in the same directory as the
html file. The source above also assumes an unregistered applet as
it does not have the NumericalKey parameter (this removes the
intro text in the applet).
Form and JavaScript code
Don't forget to name the applet to be able to call it.
<form>
<input type="button" value="New main" onClick="if(navigator.appVersion.substring(0,1)
>= 4) document.scroller.newMain('<pause
4000><br><h>New main message</h>This message
was put to the applet from the left button below.</h><ff><pause
3000><br>Feel free to click any other button.<ff>');"
>
<input type="button" value="New temporary" onClick="if(navigator.appVersion.substring(0,1)
>= 4) document.scroller.newTemporary('<pause
2500><br><h>This is a temporary message</h><ff><pause
2500><br>Now back to the current main message...<ff>');"
>
<input type="button" value="From file" onClick="if(navigator.appVersion.substring(0,1)
>= 4) document.scroller.newMainFromFile('TextInput.txt');"
>
</form>
|