javascript使用call调用微信API
代码很简单,只是给大家一个思路的,这里就不多废话了,奉上源码:
<!DOCTYPEhtml> <html> <head> <title>微信JsAPIDemo</title> <metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"> <linkrel="dns-prefetch"href="http://mmbiz.qpic.cn"> <linkrel="dns-prefetch"href="http://res.wx.qq.com"> <metaname="viewport"content="width=device-width,height=device-height,inital-scale=1.0;"> <metaname="apple-mobile-web-app-capable"content="yes"> <metaname="apple-mobile-web-app-status-bar-style"content="black"> <metaname="format-detection"content="telephone=no"> <styletype="text/css"> p{ padding:5px10px; } </style> <scripttype="text/javascript"src="WeixinApi.js?v=1"></script> </head> <body> <scriptlanguage="javascript"> <!-- functionClass1(){ this.name="class1"; this.aaa="aaa"; this.showNam=function(){ alert(this.name); } } functionClass2(){ this.name="class2"; } varc1=newClass1(); varc2=newClass2(); //c1.showNam(); c1.showNam.call(c2);//对象置换,针对方法而言 c1.aaa.call(c2);//错误,只能针对方法继承,属性不支持 --> </script>
</body> </html>