|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content='True' name='HandheldFriendly' />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title></title>
<script src="res/js/mobile-core.js"></script>
<script src="res/js/zepto.js"></script>
<script src="res/js/base64.js"></script>
<script src="res/js/jcl.js"></script>
<script src="res/js/wade-mobile.js"></script>
<script src="res/js/expand-mobile.js"></script>
<script src="biz/js/common/biz-mobile.js"></script>
</head>
<body>
<script type="text/javascript">
//WadeMobile.tip("你好,我好,大家好………………");
</script>
<h1>myindex2</h1>
<button style="width:200px;height:100px;" id="openBrowser">打开浏览器(无回调)</button>
<script type="text/javascript">
var btn = document.getElementById("openBrowser");
btn.onclick = function(){
//WadeMobile.openBrowser("http://3g.baidu.com");
WadeMobile.getContacts(function(result){
alert(result.toString());
});
}
</script>
<br /><br />
<button style="width:200px;height:100px;" id="getImei">获取手机IMEI号(回调)</button>
<script type="text/javascript">
var btn = document.getElementById("getImei");
btn.onclick = function(){
WadeMobile.getImei(function(result){
alert("手机IMEI号为:" + result);
},function(msg){
alert("我是异常处理函数,来自android的异常信息为:" + msg)
});
}
</script>
<br /><br />
<button style="width:200px;height:100px;" id="setMemoryCache">设置缓存</button>
<script type="text/javascript">
var btn = document.getElementById("setMemoryCache");
btn.onclick = function(){
WadeMobile.setMemoryCache("Key001","我是缓存中的测试值-Value001");
}
</script>
<br /><br />
<button style="width:200px;height:100px;" id="getMemoryCache">获取缓存</button>
<script type="text/javascript">
var btn = document.getElementById("getMemoryCache");
btn.onclick = function(){
WadeMobile.getMemoryCache(function(value){
alert(value);
},"Key001","没有取到值我,我是默认值");
}
</script>
<br /><br />
<button style="width: 200px;height: 100px;" id="sendAjaxPost">发送Post请求</button>
<script type="text/javascript">
var btn = document.getElementById("sendAjaxPost");
btn.onclick = function(){
//创建XMLHttpRequest对象
xhr = new XMLHttpRequest();
//注册回调函数
xhr.onreadystatechange=callback;
//第一个参数设置成post,第二个写url地址,第三个为是否采用异步方式
xhr.open("POST","data",true);
//post请求需要自己设置请求头
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
//post请求
xhr.send("name=lisi");
}
function callback(){
//接收响应数据
//判断对象状态是否交互完成,如果为4则交互完成
if(xhr.readyState == 4){
//判断对象状态是否交互成功,如果成功则为200
if(xhr.status == 200){
//接收数据,得到服务器输出的纯属文本数据
var response = xhr.responseText;
alert("返回的数据为:" + response);
}
}
}
</script>
<br /><br />
<button style="width:200px;height:100px;" id="goCustomerCentre">跳转到CustomerCentre</button>
<script type="text/javascript">
var btn = document.getElementById("goCustomerCentre");
btn.onclick = function(){
window.location.href="http://10.0.2.2:8080/start";
}
</script>
<br /><br />
<input type="text" style="width: 200px;height: 100px;">
<script type="text/javascript">
window.WadeMobile.onMobileBackPressed = function(paramObj){
if(!paramObj.isRemoved){
alert("返回键被点击了。在这里可以执行相应的s方法。下面将从父页面中移除本iframe!"
+ "onMobileBackPressed方法返回值为false时,将允许返回键事件继续传播,"
+ "onMobileBackPressed方法返回值为true时,表示已经处理完此返回键事件,本次事件将终止传播。");
alert("返回事件中传递的信息为:" + paramObj.message);
//修改paramObj对象中的信息属性
paramObj.message = "被iframe修改过的message -- 工号'myindex2'";
var testIframe = top.document.getElementById('testIframe2');
paramObj.isRemoved = true;
if(testIframe){
testIframe.parentNode.removeChild(testIframe);
}
return false;
}
}
</script>
</body>
</html>
|