EarthWeb
Developer.com
Site
windows 2000
visual c++
java
visual basic
javascripts
recommend it
 
Book
thinking in java
 
Interact
forum
guest book
jobs
jokes
what's new

share code
 
Resource
add resource
modify resource
new resource
 

[Internet Jobs]
-----
Java by E-mail:

Get the weekly e-mail highlights on Java!
-----

-

Set Applet PARAM VALUE from javascript


Author: Real Gagnon
Author's WebSite: http://tactika.com/realhome/realhome.html

PARAM VALUE can't be changed ar run-time but during layout time, javascript "entities" can be used to set calculated VALUES.

In this How-to, VALUES are coming from a javascript variable, a javascript function and a javascript expression.


<HTML></HTML><HEAD>
<SCRIPT>
var jsVar = "Hello World from jsVar";

function jsFnct() {
return "Hello World from jsFnct";
}

</SCRIPT></HEAD><BODY>
<APPLET CODE ="MyApplet.class" HEIGHT=100 WIDTH=400>
<PARAM NAME="first" VALUE="&{jsVar};">
<param name="second" value="&{jsFnct()};">
<param name="third" value="&{'hello world'.toUpperCase() + ' from js Expression'};">
</APPLET>
</BODY></HTML>



For demonstration purpose, the MyApplet class


 import java.applet.*;    
 import java.awt.*;    

 public class MyApplet extends Applet  {

  public void init() {
   add(new Label(getParameter("first")));
   add(new Label(getParameter("second")));
   add(new Label(getParameter("third")));
   }
  }



NOTE: Javascript entities are not supported in IE. The workaround is to use the document.write() method to customize the APPLET PARAM during layout time.

Posted On: 7-Jul-1999

internet.commerce