编程语言

img Tansf

JAVASCRIPT调用JAVA

发表于2004/11/3 15:22:00  1571人阅读

分类: JAVA/JSP

//*********java.htm************
<HTML><HEAD></HEAD><BODY>
<SCRIPT>
function getScreenDimension() {
document.myApplet.sayHello();
 }
</SCRIPT>
<FORM>
<INPUT type="button" value="call JAVA"
   onClick = "getScreenDimension()">
</FORM>
<APPLET CODE="inJava.class" 
        NAME="myApplet"
        HEIGHT=100 WIDTH=100>
</APPLET>
</BODY></HTML>

//*********inJava.java***********
import java.awt.*;
import java.applet.*;
public class inJava extends Applet{
  public void sayHello() {
    Graphics g = getGraphics();
    g.drawString("Hello from JAVA!", 10, 10);
    }
  }

阅读全文
0 0

相关文章推荐

img
取 消
img