DRAGRI User Manual

Go to index>>

Interoperating with JavaScript




Manipulating content from JavaScript

seek()

There is a public method called seek() in the Java applets that come with DRAGRI. It allows a jump to any frame number from JavaScript. It is necessary to add the name attribute to the <APPLET> tag to give a name to the applet.

Example

<APPLET width=320 height=240 code="Dragri.class" archive="dragri.jar" name="dragriapplet">
<PARAM NAME=PRELOAD VALUE=TRUE>
<PARAM NAME=BGCOLOR VALUE="FFFFFF">
<PARAM NAME=MESSAGE VALUE="DRAGRI Loading">
</APPLET>
<P>
<A href="javascript:dragriapplet.seek(0)">[Restart]</A>

load()

If you use the public method load(), you can read in the content in a specified directory. For details, see "Setting segmented loading".

Example

<APPLET width=320 height=240 code="Dragri.class" archive="dragri.jar" name="dragriapplet">
<PARAM NAME=PRELOAD VALUE=TRUE>
<PARAM NAME=BGCOLOR VALUE="FFFFFF">
<PARAM NAME=MESSAGE VALUE="DRAGRI Loading">
</APPLET>
<P>
<A href="javascript:dragriapplet.load('main')">[Play main]</A>



Calling JavaScript from within content

If you specify "javascript" as the target in a link event, the function specified in the URL field is called.

In the above example, the function "func1()" is called with "Hello" as the argument.

Corresponding JavaScript should be written in an HTML file. In addition, a mayscript attribute is added to the <APPLET> tag to permit the applet to call JavaScript.

Example


<script lang="javascript">
<!--
function func1(mes) {
  alert(mes);
}
// -->
</script>

<APPLET width=320 height=240 code="Dragri.class" archive="dragri.jar" mayscript>
<PARAM NAME=PRELOAD VALUE=TRUE>
<PARAM NAME=BGCOLOR VALUE="FFFFFF">
<PARAM NAME=MESSAGE VALUE="DRAGRI Loading">
</APPLET>
<P>
NTT Advanced Technology Corporation