473,770 Members | 3,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scripts and Applet


Hi;

I have two problems regarding Scripts and Applets. I need to construct a
page that has some instances of the same Applet. These instances are
responsible to get informations from the user and the system. The
information is latter sent to the site.

How can I reference distinct Applets instances of the same Applet Class
inside the page?
How can I get the values stored in the Applet's variables using
JavaScript?

Thank you
Roberto Gallo.


Jul 20 '05 #1
2 1758


Roberto Gallo wrote:
I have two problems regarding Scripts and Applets. I need to construct a
page that has some instances of the same Applet. These instances are
responsible to get informations from the user and the system. The
information is latter sent to the site.

How can I reference distinct Applets instances of the same Applet Class
inside the page?
How can I get the values stored in the Applet's variables using
JavaScript?


Well, for JavaScript is doesn't matter what class an applet is an
instance of, if you use an <applet> element like
<applet name="applet1" ...>...</applet>
then Javascript can access
var applet = document.applet s.applet1;
Then you can check
if (applet.methodN ame) {
var s = applet.methodNa me();
}
and the applet should have a public method methodName that returns the
value you want from the applet.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Martin Honnen wrote:


Roberto Gallo wrote:
I have two problems regarding Scripts and Applets. I need to
construct a
page that has some instances of the same Applet. These instances are
responsible to get informations from the user and the system. The
information is latter sent to the site.

How can I reference distinct Applets instances of the same Applet
Class
inside the page?
How can I get the values stored in the Applet's variables using
JavaScript?

Well, for JavaScript is doesn't matter what class an applet is an
instance of, if you use an <applet> element like
<applet name="applet1" ...>...</applet>
then Javascript can access
var applet = document.applet s.applet1;
Then you can check
if (applet.methodN ame) {
var s = applet.methodNa me();
}
and the applet should have a public method methodName that returns the
value you want from the applet.

Be aware that you have to be sure that the applet is already loaded
before you call any methods. Otherwise you will get a 'applet.methodN ame
is not a function'-error (at least for Mozilla on Linux, at Windows it
works fine for IE and Mozilla).
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
9523
by: nathanlaan | last post by:
This is the stupidest thing I have ever seen. Java 1.2, 1.3, and 1.4.1, and 1.4.2 all define the Applet.getDocumentBase() method differently! How am I supposed to get the directory of the document in which the applet is embedded (like Java 1.3) using Java 1.4.2??? http://java.sun.com/products/jdk/1.2/docs/api/java/applet/Applet.html#getDocumentBase() http://java.sun.com/j2se/1.3/docs/api/java/applet/Applet.html#getDocumentBase()
0
9873
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ********************************** package Celcom.Client;
1
2944
by: Charlie Kim | last post by:
Here is gnome applet source of mine. -------------------------------------------------- #!/usr/bin/env python import pydic import gtk import gnome.applet
8
3393
by: DKM | last post by:
Here are the source code files to a Java applet that utilizes LiveConnect to communicate with Javascript, and the HTML file. The thing works both in IE 6.0 and FireFox 1.4. but with some problems. IE crashes when one refreshes the page or leave the page. This happens only after calling the Java method more than once. It does not crash if the Java method is called just once and then the page is refreshed. FireFox does not crash at all...
0
5663
by: ankur | last post by:
WHEN I RUN THIS WEB APPLICATION ON Tomcat5.5.9 SERVER MY HttpChatApplet sccessfully Loaded from ChatDispatch but running on some another PC HttpChatApplet not loaded my Coad ChatDispatch.java
1
4634
by: dcnicholls | last post by:
This is my first post to this forum: I use ASP occasionally but don't know a lot of it, and the Windows IIS was invented by MS to torture me :) So I'm not sure if this should be herre or on the IIS area, but here goes: For the local mirror on my development PC of a site I've been managing for some years, I use the built in IIS (XP pro sp2) to act as a server for local web pages, and some of them use a little bit of simple ASP scripting. ...
3
5430
by: vunet.us | last post by:
Hi, My web application needs to retrieve some client's info, such as MAC address, IP, OS, etc. Java Applet does it well (with one time security warning). But if Java is not installed, I am unable to run applet. So, I need to find the equivalent in, perhaps, VBScript. The question is: how can I read client's MAC address, IP, OS, etc. through web interface on, mostly, Windows OS? Is it something like VBS file? Or EXE file only? Any ideas?
4
7822
by: tudyfruity18 | last post by:
I'm suppose to write an applet that contains two buttons Investment calculator and Loan Calculator. When the Investment Calculator button is clicked, a frame appears in a new window for calculating future investment values. When you click Loan Calculator button, a frame appears in a separate new window for computong loan payments. Here's my coding: // Lab3.java: import java.awt.*; import java.awt.event.*; import javax.swing.*; ...
1
2387
by: sheephead86 | last post by:
Hi, I'm pretty new to java, and I have a small problem involving drawing a rectangle on a java applet.Firstly this is not a plea for someone to help me with this peice of work, I just need pointing in the right direction. Ok the problem. I am creating a program that ask the user to input a height value, the program will then do a calculation and create a golden ratio width. The type of both the height and the width are double. This is...
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.