Solved

How to pass variable for PARAM's value.

Posted on 1998-06-24
6
213 Views
Last Modified: 2010-03-30
I want to pass parameter value to JAVA applet.
The value is not a Constant-value String, rather, it is
a Variable-value String.
eg
<applet code="RainbowText9.class" width=340  height=22>
<param name=text value=varnam>
                 (instead of value="Welcome to ...."
Note : varnam is a SCRIPT variable that have been assigned
       with value.
</applet>

My question is :-
   a) It is allow to pass a SCRIPT's variable (varnam)
      to the Applet's PARAM VALUE=varnam
   b) If (a) above is not allow, then how can this be done?  
Rgds,

0
Comment
Question by:heng03
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:msmolyak
ID: 1223639
No, Java expects a constant string as a parameter. The simplest solution is to use JavaScript to modify the applet tag before the applet is started. I'll try to come up with an example.
0
 
LVL 4

Accepted Solution

by:
evijay earned 20 total points
ID: 1223640
the syntax is &{javascriptvariablename}

So, your tag becomes


<applet code="RainbowText9.class" width=340  height=22>
       <param name=text value=&{javascriptvarnam}>
 
       </applet>
0
 
LVL 4

Expert Comment

by:evijay
ID: 1223641
Sorry for the typo

the answer is like this


       the syntax is &{javascriptvariablename};

       So, your tag becomes


       <applet code="RainbowText9.class" width=340  height=22>
              <param name=text value=&{javascriptvarnam};>

 
         
              </applet>
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:heng03
ID: 1223642
Hi evijay,
Thanks for your help.
I have a few question related to the above example applet.
I want to pass variable to the applet's width= parameter
 
   eg
   <applet code="RainbowText9.class" width=varsize  height=22>
                         (instead of width=320)
   Note : varsize is a SCRIPT variable that have been assigned
          with numeric value. eg varsize=250;
   </applet>

   P.S. : I tried width=&{varsize}, but do not work
          I tried width=varsize & width=&varsize, also
          do not work.
Pls advice, thank you.

0
 

Author Comment

by:heng03
ID: 1223643
Hi Evijay,
I have one more question :-
a) This RainbowText9 class is extends Applet and Implement Runnable. Beside running in browser as applet, how can I run
it in DOS/window as a application.

Note :
I tried C:\JAVA\BIN\JAVA RainbowText9
But got message "In class RainbowText9: void main(String argv[])
is undefined.

Pls help. Thanks.


0
 

Author Comment

by:heng03
ID: 1223644
Hi Evijay,

I tried width=&{varsize};   (this work OK)
Thanks

0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question