主题:脚本错误
//MyApplet.java
import java.applet.*;
import java.awt.*;
public class MyApplet extends Applet
{
public String text = "a";
public void paint(Graphics g)
{
g.setFont(new Font(null,Font.ITALIC|Font.BOLD,30));
g.drawString(text,110,60);
}
}
//MyApplet.html
<html>
<applet
code="MyApplet.class"
name ="app"
width=200
height=100
>
<script language="javascript">
function setText()
{
document.app.text =content.value;
document.app.repaint();
}
</script>
</applet>
<br>
<input type="text" name=content>
<input type="button" value="改变文本" onclick="setText()">
< ml>
文本框输入文字后,按按钮,弹出错误,知不知道哪里出错?
弹出对话框内容为
Inetrnet Explorer 脚本错误
行: 21
char:1
错误:缺少对象
代码:0
URL:file:///D:/java/MyApplet.html
import java.applet.*;
import java.awt.*;
public class MyApplet extends Applet
{
public String text = "a";
public void paint(Graphics g)
{
g.setFont(new Font(null,Font.ITALIC|Font.BOLD,30));
g.drawString(text,110,60);
}
}
//MyApplet.html
<html>
<applet
code="MyApplet.class"
name ="app"
width=200
height=100
>
<script language="javascript">
function setText()
{
document.app.text =content.value;
document.app.repaint();
}
</script>
</applet>
<br>
<input type="text" name=content>
<input type="button" value="改变文本" onclick="setText()">
< ml>
文本框输入文字后,按按钮,弹出错误,知不知道哪里出错?
弹出对话框内容为
Inetrnet Explorer 脚本错误
行: 21
char:1
错误:缺少对象
代码:0
URL:file:///D:/java/MyApplet.html