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

onLoad attribute for Applet tag doesn't work?

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I'm trying to test the onLoad Event Handler that what i assume we can use with applet tag or Object tag.as :
<object code="TextFieldApplet10.class" id="matt" width="500" height="200" onLoad="show();" >
</object>
just simply i need to click on the applet and get what ever response fro show() method.
I used it with the input tag for button and it works,but with applet tag it doesn't work for some reason.
Here is the java and html files.
//======= TextFieldApplet10.java=====
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class TextFieldApplet10 extends Applet
{
public void init()
{
TextField txt1 = new TextField(" ");
add(txt1);
txt1.addActionListener(new moh());
this.setBackground(Color.red);
}
}
class moh implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Hello");
}
}
//======testApplet.html =====
<script language="javascript" >
function show()
{
var y=88;
document.writeln("hello world today ");
return y;
}
</script>
<html>
<body>
<form action="" >
<object code="TextFieldApplet10.class" id="matt" width="500" height="200" onLoad="show();" >
</object>
<input type="button" value="Click on me " onClick="show();"></a>
</form>
</body>
</html>
 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
The <applet> tag has been deprecated. The Object code does not have an option called onLoad.
You can try this link for the option details
Suneel

[This message has been edited by Suneel Setlur (edited April 01, 2001).]
 
Honk if you love justice! And honk twice for tiny ads!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic