StupidBeauty
Read times:634Posted at:Thu Dec 6 04:04:14 2012
- no title specified

转载 ExternalInterface.call

使用ExternalInterface.call时,可将 javascript 函数 和其中的参数写成一整个字符串来调用。这样就 可以实现调用那种 在运行时才能确定其参数个数的函数了 ,把字符串拼凑好即可

http://cunnyyun.blogspot.com/2010/10/externalinterfacecall.html

亮点

非標準寫法

ExternalInterface.call("sendToJavaScript('"+input.text+"')");

看出不同的地方了嗎???

沒錯!!就是改寫成直接帶入函式來使用

當然!要注意的是!引號的問題!!如果input.text裡有單引號的話!就會造成錯誤

可以用JSON.encode()去處理就行了

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands