Guest_imported
New member
- Jan 1, 1970
- 0
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>
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>