将值从javascript传递和返回到android
亲爱的各位,我只是传递并重新引用javascript和android中的一些值。我可以将javascript值传递给android。我的问题是无法再次返回值。这是我的片段。有人能帮我吗 HTML和脚本将值从javascript传递和返回到android,javascript,android,parameter-passing,Javascript,Android,Parameter Passing,亲爱的各位,我只是传递并重新引用javascript和android中的一些值。我可以将javascript值传递给android。我的问题是无法再次返回值。这是我的片段。有人能帮我吗 HTML和脚本 <html> <head> <script src="phonegap-1.3.0.js" type="text/javascript"></script> <script type="text/javascrip
<html>
<head>
<script src="phonegap-1.3.0.js" type="text/javascript"></script>
<script type="text/javascript">
function invoke(param1,param2)
{
alert('Hai');
//invoking the JavascriptBridge registered under the 'jb' namespace
var result = jb.callMe(param1,param2);
//doing something with the return value, it should be concatenation
//of the two input parameters
alert(result);
}
</script>
</head>
<body>
<form id = "returning">
<h2>Demonstrating Android Javascript-To-Java Bridge</h2>
<input type="button" value="Invoke Bridge" onclick="invoke('Hello','World');"/>
</form>
</body>
}在javascript中定义一个以上的函数:
<script>
function my_callback_function(param){
alert("Called with value: " + param);
}
</script>
就在昨天,我回答了同样的问题。请看这里:@Boris….是的…但在我的情况下,请告诉我在哪里编辑….我会稍后再看
<script>
function my_callback_function(param){
alert("Called with value: " + param);
}
</script>
webView.loadUrl("javascript:my_callback_function('TheValue')");