Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Running an applet by clicking a Button on HTML page

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can any one of you tell me how to start an applet running by clicking a hyperlink or a button on a HTML page? I think this is possible.I will be glad if any one can give a small piece of code which does this.
Thank You.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try calling a javascript function on "onClick" event of the button.
Inside the function do as follows:
top.frameName.document.write('<APPLET WIDTH=100
HEIGHT=100
NAME="appletname"
CODE="appletname.class"
</APPLET>');
Here frameName indicates the frame where you want the applet to run.
You can also run the applet on a new window as follows:
Inside the function:
var win=window.open("","","location=0,menubar=0,resizable=0,toolbar=0,status=0,height=150,width=500");
win.document.writeln('<APPLET WIDTH=100
HEIGHT=100
NAME="appletname"
CODE="appletname.class"
</APPLET>');
Hope this solves your purpose.
 
no wonder he is so sad, he hasn't seen this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic