Next
example
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_SubjectTicker.class" name="ticker"
width="400" height="20">
<!--The file where the messages can be found.-->
<param name="InputFile" value="Input.txt">
<!--The color of the background while the input file is loading.-->
<param name="BGLoadingColor" value="000000">
<!--The proportion between the Subject part and the headline part.-->
<param name="SubjectWidth" value="120">
<!--Border parameters.-->
<param name="BorderColor" value="000000">
<param name="BorderThickness" value="2">
</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.ticker.newMain('§Main
from button|You have clicked the left button...| | |a00000|eeeeee|fff2d0|111111§Main
from button|...and this is the new main message.| | |a00000|eeeeee|fff2d0|111111');"
>
<input type="button" value="New temporary" onClick="if(navigator.appVersion.substring(0,1)
>= 4) document.ticker.newTemporary('§Temp.
from button|This is the temporary message.| |2000|3333ee|eeee88|eeee88|3333ee§Temp.
from button|Back to the current main message.| |2000|3333ee|eeee88|eeee88|3333ee');"
name="button" >
<input type="button" value="From file" onClick="if(navigator.appVersion.substring(0,1)
>= 4) document.ticker.newMainFromFile('Input.txt');"
>
</form>
|