我知道如何将参数从HTML传递到Applet,有人可以显示如何将参数从Applet传递给HTML吗?
Try following:
applet code:
public class applet_test extends Applet {
private InetAddress addr = null;
public void init() {
try {
addr = InetAddress.getLocalHost();
}
catch (UnknownHostException e) {
System.exit(0);
}
}
public InetAddress getLHost() {
return addr;
}
}
HTML Code:
<html>
<body>
<APPLET CODE=applet_test.class Width=0 Height=0></APPLET>
<script type="text/javascript">
document.write(document.applets[0].getLHost());
</script>
</body>
</html>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.