Solved

Passing parameters to a Java applet from JavaScript

Posted on 1998-10-20
6
426 Views
Last Modified: 2008-03-03
Does anyone know how can I pass parameters to a Java applet on a web page using JavaScript's onclick that calls a function.

I want to be able to pass different parameters to the applet every time a button has been clicked etc.

Any ideas?

By the way. I'm using Netscape 3 under Win95.
0
Comment
Question by:dedo_mraz
[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
  • 3
6 Comments
 

Author Comment

by:dedo_mraz
ID: 1272521
Edited text of question
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 100 total points
ID: 1272522
<APPLET NAME="myApplet"....>

<FORM>
<INPUT TYPE="BUTTON" VALUE="javafunction1" onClick="document.myApplet.javafunction1()">
<INPUT TYPE="BUTTON" VALUE="javafunction2" onClick="document.myApplet.javafunction2()">
</FORM>

The functions need to be public and the applet needs to have been loaded first... NS3 is finicky about reloading applets at resize though so be careful...

Michel
0
 

Author Comment

by:dedo_mraz
ID: 1272523
Good one Michel, but...

I know how to invoke methods that are already defined inside the applet and do things.

My question was:

If I have an applet like this...

<applet code="paramtst" name="appletBig"
    width="266" height="150">
        <param name="someNumber" value="12346">
        <param name="someText" value="Whats up Doc?!">
</applet>

How do I pass a parameter to "someNumber" using onclick ?
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1272524
I would think
<INPUT TYPE="TEXT" NAME="SomeNumber">
<INPUT TYPE="BUTTON" VALUE="SetSomeNumber"
onClick="document.myApplet.someNumber=parseInt(this.form.SomeNumber);">

but I am not 100% sure on this. Since the parameters are normally read in the init() method, wouldn't it be safer to do a
<INPUT TYPE="BUTTON" VALUE="Set SomeNumber"
onClick="document.myApplet.setSomeNumber(parseInt(this.form.SomeNumber))">
and have a public function to change the parameters.

Michel
0
 

Author Comment

by:dedo_mraz
ID: 1272525
Do you by any chance have a/some URL/s handy that use the above implementation?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1272526
The implementation is pretty straight forward but have a closer look at Live Wire at http://devedge.netscape.com

Michel
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 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