二、HTML調(diào)用
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>微信JS-SDK Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0"> <link rel="stylesheet" href="http://demo.open.weixin.qq.com/jssdk/css/style.css?ts=1420774989"></head><body ontouchstart=""><div class="wxapi_container"> <div class="wxapi_index_container"> <ul class="label_box lbox_close wxapi_index_list"> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-basic">基礎(chǔ)接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-share">分享接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-image">圖像接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-voice">音頻接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-smart">智能接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-device">設(shè)備信息接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-location">地理位置接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-webview">界面操作接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-scan">微信掃一掃接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-shopping">微信小店接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-card">微信卡券接口</a></li> <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-pay">微信支付接口</a></li> </ul> </div> <div class="lbox_close wxapi_form"> <h3 id="menu-basic">基礎(chǔ)接口</h3> <span class="desc">判斷當(dāng)前客戶端是否支持指定JS接口</span> <button class="btn btn_primary" id="checkJsApi">checkJsApi</button> <h3 id="menu-share">分享接口</h3> <span class="desc">獲取“分享到朋友圈”按鈕點(diǎn)擊狀態(tài)及自定義分享內(nèi)容接口</span> <button class="btn btn_primary" id="onMenuShareTimeline">onMenuShareTimeline</button> <span class="desc">獲取“分享給朋友”按鈕點(diǎn)擊狀態(tài)及自定義分享內(nèi)容接口</span> <button class="btn btn_primary" id="onMenuShareAppMessage">onMenuShareAppMessage</button> <span class="desc">獲取“分享到QQ”按鈕點(diǎn)擊狀態(tài)及自定義分享內(nèi)容接口</span> <button class="btn btn_primary" id="onMenuShareQQ">onMenuShareQQ</button> <span class="desc">獲取“分享到騰訊微博”按鈕點(diǎn)擊狀態(tài)及自定義分享內(nèi)容接口</span> <button class="btn btn_primary" id="onMenuShareWeibo">onMenuShareWeibo</button> <h3 id="menu-image">圖像接口</h3> <span class="desc">拍照或從手機(jī)相冊(cè)中選圖接口</span> <button class="btn btn_primary" id="chooseImage">chooseImage</button> <span class="desc">預(yù)覽圖片接口</span> <button class="btn btn_primary" id="previewImage">previewImage</button> <span class="desc">上傳圖片接口</span> <button class="btn btn_primary" id="uploadImage">uploadImage</button> <span class="desc">下載圖片接口</span> <button class="btn btn_primary" id="downloadImage">downloadImage</button> <h3 id="menu-voice">音頻接口</h3> <span class="desc">開(kāi)始錄音接口</span> <button class="btn btn_primary" id="startRecord">startRecord</button> <span class="desc">停止錄音接口</span> <button class="btn btn_primary" id="stopRecord">stopRecord</button> <span class="desc">播放語(yǔ)音接口</span> <button class="btn btn_primary" id="playVoice">playVoice</button> <span class="desc">暫停播放接口</span> <button class="btn btn_primary" id="pauseVoice">pauseVoice</button> <span class="desc">停止播放接口</span> <button class="btn btn_primary" id="stopVoice">stopVoice</button> <span class="desc">上傳語(yǔ)音接口</span> <button class="btn btn_primary" id="uploadVoice">uploadVoice</button> <span class="desc">下載語(yǔ)音接口</span> <button class="btn btn_primary" id="downloadVoice">downloadVoice</button> <h3 id="menu-smart">智能接口</h3> <span class="desc">識(shí)別音頻并返回識(shí)別結(jié)果接口</span> <button class="btn btn_primary" id="translateVoice">translateVoice</button> <h3 id="menu-device">設(shè)備信息接口</h3> <span class="desc">獲取網(wǎng)絡(luò)狀態(tài)接口</span> <button class="btn btn_primary" id="getNetworkType">getNetworkType</button> <h3 id="menu-location">地理位置接口</h3> <span class="desc">使用微信內(nèi)置地圖查看位置接口</span> <button class="btn btn_primary" id="openLocation">openLocation</button> <span class="desc">獲取地理位置接口</span> <button class="btn btn_primary" id="getLocation">getLocation</button> <h3 id="menu-webview">界面操作接口</h3> <span class="desc">隱藏右上角菜單接口</span> <button class="btn btn_primary" id="hideOptionMenu">hideOptionMenu</button> <span class="desc">顯示右上角菜單接口</span> <button class="btn btn_primary" id="showOptionMenu">showOptionMenu</button> <span class="desc">關(guān)閉當(dāng)前網(wǎng)頁(yè)窗口接口</span> <button class="btn btn_primary" id="closeWindow">closeWindow</button> <span class="desc">批量隱藏功能按鈕接口</span> <button class="btn btn_primary" id="hideMenuItems">hideMenuItems</button> <span class="desc">批量顯示功能按鈕接口</span> <button class="btn btn_primary" id="showMenuItems">showMenuItems</button> <span class="desc">隱藏所有非基礎(chǔ)按鈕接口</span> <button class="btn btn_primary" id="hideAllNonBaseMenuItem">hideAllNonBaseMenuItem</button> <span class="desc">顯示所有功能按鈕接口</span> <button class="btn btn_primary" id="showAllNonBaseMenuItem">showAllNonBaseMenuItem</button> <h3 id="menu-scan">微信掃一掃</h3> <span class="desc">調(diào)起微信掃一掃接口</span> <button class="btn btn_primary" id="scanQRCode0">scanQRCode(微信處理結(jié)果)</button> <button class="btn btn_primary" id="scanQRCode1">scanQRCode(直接返回結(jié)果)</button> <h3 id="menu-shopping">微信小店接口</h3> <span class="desc">跳轉(zhuǎn)微信商品頁(yè)接口</span> <button class="btn btn_primary" id="openProductSpecificView">openProductSpecificView</button> <h3 id="menu-card">微信卡券接口</h3> <span class="desc">批量添加卡券接口</span> <button class="btn btn_primary" id="addCard">addCard</button> <span class="desc">調(diào)起適用于門店的卡券列表并獲取用戶選擇列表</span> <button class="btn btn_primary" id="chooseCard">chooseCard</button> <span class="desc">查看微信卡包中的卡券接口</span> <button class="btn btn_primary" id="openCard">openCard</button> <h3 id="menu-pay">微信支付接口</h3> <span class="desc">發(fā)起一個(gè)微信支付請(qǐng)求</span> <button class="btn btn_primary" id="chooseWXPay">chooseWXPay</button> </div> </div></body><script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"> </script><script> wx.config({ debug: false, appId: 'wxf8b4f85f3a794e77', timestamp: 1420774989, nonceStr: '2nDgiWM7gCxhL8v0', signature: '1f8a6552c1c99991fc8bb4e2a818fe54b2ce7687', jsApiList: [ 'checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'hideMenuItems', 'showMenuItems', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem', 'translateVoice', 'startRecord', 'stopRecord', 'onRecordEnd', 'playVoice', 'pauseVoice', 'stopVoice', 'uploadVoice', 'downloadVoice', 'chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'getNetworkType', 'openLocation', 'getLocation', 'hideOptionMenu', 'showOptionMenu', 'closeWindow', 'scanQRCode', 'chooseWXPay', 'openProductSpecificView', 'addCard', 'chooseCard', 'openCard' ] });</script><script src="http://demo.open.weixin.qq.com/jssdk/js/api-6.1.js?ts=1420774989"> </script></html>
聯(lián)系客服