你好,游客 登录 注册 搜索
背景:
阅读新闻

Android与js交互实例

[日期:2013-03-30] 来源:Linux社区  作者:sunboy [字体:大 中 小]

2) js(HTML)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0032)http://localhost:8080/jsAndroid/ -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-store,no-cache">
<meta name="Handheldfriendly" content="true">
<meta name="viewport" content="width=100%; initial-scale=1.0; user-scalable=yes">
<meta name="robots" content="all">
<meta name="keywords" contect="doodle, mobile, doodlemobile, game, games">
<meta name="description" content="Make People's Mobile Life More Connected Through Games.">

<title>jsandroid_test</title>

<script type="text/javascript" language="javascript">
 
 function showHtmlcallJava(){
  var str = window.jsObj.HtmlcallJava();
  alert(str);
 }
 
 function showHtmlcallJava2(){
  var str = window.jsObj.HtmlcallJava2("IT-homer blog");
  alert(str);
 }
 
 function showFromHtml(){
  document.getElementById("id_input").value = "Java call Html";
 }
 
 function showFromHtml2( param ){
  document.getElementById("id_input2").value = "Java call Html : " + param;
 }
</script>
</head>


<body>

hello IT-homer

<br>
<br>
<br>

<input type="button" value="HtmlcallJava" onclick="showHtmlcallJava()" />
<br>
<input type="button" value="HtmlcallJava2" onclick="showHtmlcallJava2()" />

<br>
<br>
<br>
<br>

<input id="id_input" style="width: 90%" type="text" value="null" />
<br>
<input type="button" value="JavacallHtml" onclick="window.jsObj.JavacallHtml()" />

<br>
<br>
<br>

<input id="id_input2" style="width: 90%" type="text" value="null" />
<br>
<input type="button" value="JavacallHtml2" onclick="window.jsObj.JavacallHtml2()" />

</body>
</html>

linux
相关资讯       Android实例  Android与js交互 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款