JSObject.call()--Applet与Javascript通讯

JSObject.call() Java Method

Name

JSObject.call() Java Method---invoke a method of a JavaScript object

Availability

Part of the netscape.javascript package included with Navigator 3.0

Synopsis

 

public Object call(String methodName, Object args[])

Arguments

methodName

The name of the JavaScript method to be invoked.

 

args[]

An array of Java object to be passed as arguments to the method.

Returns

A Java Object that represents the return value of the JavaScript method.

Description

The call() method of the Java JSObject class invokes a named method of the JavaScript object represented by the JSObject. Arguments are passed to the method as an array of Java objects, and the return value of the JavaScript method is returned as a Java object. Chapter 19, LiveConnect: JavaScript and Java describes the data conversion performed to convert the method arguments from Java objects to JavaScript values and to convert the method return value from a JavaScript value to a Java object.

 

 

EG:前台获得参数,来改变panel的宽度,其中宽度在panel类里定义为全局变量。若前台设置JS参数为99或不为空,则改变size为630,否则为800.

Applet里面,你可以这样设置代码:

 其中isPreSchedule为JS文件里定义的isPreSchedule函数,或者JSP页面的SCRIPT里定义的JS函数:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值