Java、Java Applet与 JavaScript间的通信[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 net_lover 的 blog

text=(string) textfield.getmember("value"); //获取文本区的值
……
win.eval("alert(\"this alert comes from java!\")");
// 调用javascript的alert()方法
……
“user.htm”
……
<body>
<form name="textform">
<p>enter text and then click display text:
<input type="text" name="textfield" size="20"></p>
</form>
<applet code="readform.class" width=200 height=100 name="readapp" mayscript>
//必须使用mayscript属性标志
</applet>
</body>
附表列举了jsobject类的方法和描述,更详细的说明可以参考msdn。值得一提的是,本文中程序示例加下划线的部分,要特别引起注意。

本文关键:JavaScript
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top