我试了一下 是可以的 你看看
------Testapplet.class
import java.awt.*;
import java.applet.*;
public class Testapplet extends Applet {
public void init() {
}
public void paint(Graphics g) {
g.drawString("Welcome to Java!!", 50, 60 );
}
public String s()
{
return "dafsdf";
}
}
-----new_page_1.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<title>New Page 1</title>
</head>
<body>
<p>
<applet width="128" height="128" code="Testapplet.class" VIEWASTEXT id=applet name=applet>
</applet>
</p>
<SCRIPT LANGUAGE=javascript>
<!--
function tt()
{
alert(applet.s());
}
//-->
</SCRIPT>
<INPUT type="button" value="Button" id=button1 name=button1 onclick="tt()">
</body>
</html>