Android和js交互 ,js例子

192 阅读1分钟
<body>
<p>测试 JS调本地相册</p>
<a class="rect" onclick="sendInfoToAndroid()">JS调用相册</a>
<p><t id="img" src="file:///android_asset/a.png" width="100" height="100"/></p>
<input type="text" id="show"/>
<script>

function sendInfoToAndroid(){
//调用Android的方法启动相册
window.android.getLocationInfo();
}

function setAppLocation(path){
    document.getElementById("show").value=path;
  }

</script>
</body>