harmmeijer
Programmer
How do I get the value of my textbox "txt" in the string myString without passing the value as string but passing the entire document object. The applet can do a getElementById on this object.
I am using IE 5.0
this is the applet:
import java.applet.*;
import java.awt.*;
/**
* The HelloWorld class implements an applet that
* simply displays "Hello World!".
*/
public class HelloWorld extends Applet {
String myString;
public void paint(Graphics g) {
// Display "Hello World!"
g.drawString(myString, 50, 25);
}
public void setString(String objDocument) {
myString = "aaa hlkdjsf"; // this.getContext().getElementById("txt".value;
repaint();
}
}
this is the HTML page:
<HTML>
<HEAD>
<TITLE>A Simple Program</TITLE>
</HEAD>
<BODY>
Here is the output of my program:
<APPLET id="app" name="app" CODE="HelloWorld.class" className="" WIDTH=400 HEIGHT=25 VIEWASTEXT>
</APPLET>
<form id=frm>
<input type=button onclick="document.app.setString();">
<input type=text id="txt" name="txt">
</form>
<script>
objApp = document.getElementById('app');
// alert(objApp.getParam());
// alert(objApp.HelloWorld.getParam);
</script>
</BODY>
</HTML>
I am using IE 5.0
this is the applet:
import java.applet.*;
import java.awt.*;
/**
* The HelloWorld class implements an applet that
* simply displays "Hello World!".
*/
public class HelloWorld extends Applet {
String myString;
public void paint(Graphics g) {
// Display "Hello World!"
g.drawString(myString, 50, 25);
}
public void setString(String objDocument) {
myString = "aaa hlkdjsf"; // this.getContext().getElementById("txt".value;
repaint();
}
}
this is the HTML page:
<HTML>
<HEAD>
<TITLE>A Simple Program</TITLE>
</HEAD>
<BODY>
Here is the output of my program:
<APPLET id="app" name="app" CODE="HelloWorld.class" className="" WIDTH=400 HEIGHT=25 VIEWASTEXT>
</APPLET>
<form id=frm>
<input type=button onclick="document.app.setString();">
<input type=text id="txt" name="txt">
</form>
<script>
objApp = document.getElementById('app');
// alert(objApp.getParam());
// alert(objApp.HelloWorld.getParam);
</script>
</BODY>
</HTML>