• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onLoad attribute for Applet tag doesn't work?

 
Tom Barns
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>
 
Suneel Setlur
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic