• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

onLoad attribute for Applet tag doesn't work?

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Heroic work plunger man. Please allow me to introduce you to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic