Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML button activating Java Applet function

Status
Not open for further replies.

whodaman

Programmer
May 23, 2001
60
CA
Hi,
If I have several HTML buttons. When these buttons are pressed, I want it to change something (say a variable) on run time (while the applet is running).

For example, if this applet displays an image, when the button is pressed, I would want the applet to view the next file in that directory.

Thank you so much in advance
 
I found out that it uses this thing called LiveConnect.

Pretty much, it's easy...

HTML code:
.
.
.
<SCRIPT LANGUAGE = &quot;JavaScript1.2&quot;>
var image;

function onload()
{
image = document.applets.image // image is the name of the class
}



</SCRIPT>

.
.
.
<INPUT type=&quot;button&quot; NAME=&quot;bZoomOut&quot; VALUE=&quot;Zoom Out&quot; onClick=&quot;image.zoomOut()&quot;>


On the Java file:

public void zoomOut()
{
nw *= .75;
nh *= .75;
repaint();
}

Simple call... works wonders! :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top