微信jssdk

微信JS-SDK 分享到朋友圈 分享給朋友 分享到QQ 拍照或從手機相冊中選圖 識別音頻並返回識別結果 使用微信內置地圖查看位置
原文:http://www.cnblogs.com/txw1958/p/weixin-js-sdk-demo.html 

1 js代碼
1 wx.ready(function () {
  2   // 1 判斷當前版本是否支持指定 JS 接口,支持批量判斷
  3   document.querySelector('#checkJsApi').onclick = function () {
  4     wx.checkJsApi({
  5       jsApiList: [
  6         'getNetworkType',
  7         'previewImage'
  8       ],
  9       success: function (res) {
 10         alert(JSON.stringify(res));
 11       }
 12     });
 13   };
 14 
 15   // 2. 分享接口
 16   // 2.1 監聽「分享給朋友」,按鈕點擊、自定義分享內容及分享結果接口
 17   document.querySelector('#onMenuShareAppMessage').onclick = function () {
 18     wx.onMenuShareAppMessage({
 19       title: '監聽分享給朋友',
 20       desc: '在長大的過程當中,我才慢慢發現,我身邊的全部事,別人跟我說的全部事,那些所謂原本如此,註定如此的事,它們其實沒有非得如此,事情是能夠改變的。更重要的是,有些事既然錯了,那就該作出改變。',
 21       link: 'http://movie.douban.com/subject/25785114/',
 22       imgUrl: 'http://img3.douban.com/view/movie_poster_cover/spst/public/p2166127561.jpg',
 23       trigger: function (res) {
 24         alert('用戶點擊發送給朋友');
 25       },
 26       success: function (res) {
 27         alert('已分享');
 28       },
 29       cancel: function (res) {
 30         alert('已取消');
 31       },
 32       fail: function (res) {
 33         alert(JSON.stringify(res));
 34       }
 35     });
 36     alert('已註冊獲取「發送給朋友」狀態事件');
 37   };
 38 
 39   // 2.2 監聽「分享到朋友圈」按鈕點擊、自定義分享內容及分享結果接口
 40   document.querySelector('#onMenuShareTimeline').onclick = function () {
 41     wx.onMenuShareTimeline({
 42       title: '監聽分享到朋友圈',
 43       link: 'http://movie.douban.com/subject/25785114/',
 44       imgUrl: 'http://img3.douban.com/view/movie_poster_cover/spst/public/p2166127561.jpg',
 45       trigger: function (res) {
 46         alert('用戶點擊分享到朋友圈');
 47       },
 48       success: function (res) {
 49         alert('已分享');
 50       },
 51       cancel: function (res) {
 52         alert('已取消');
 53       },
 54       fail: function (res) {
 55         alert(JSON.stringify(res));
 56       }
 57     });
 58     alert('已註冊獲取「分享到朋友圈」狀態事件');
 59   };
 60 
 61   // 2.3 監聽「分享到QQ」按鈕點擊、自定義分享內容及分享結果接口
 62   document.querySelector('#onMenuShareQQ').onclick = function () {
 63     wx.onMenuShareQQ({
 64       title: '監聽分享到qq',
 65       desc: '在長大的過程當中,我才慢慢發現,我身邊的全部事,別人跟我說的全部事,那些所謂原本如此,註定如此的事,它們其實沒有非得如此,事情是能夠改變的。更重要的是,有些事既然錯了,那就該作出改變。',
 66       link: 'http://movie.douban.com/subject/25785114/',
 67       imgUrl: 'http://img3.douban.com/view/movie_poster_cover/spst/public/p2166127561.jpg',
 68       trigger: function (res) {
 69         alert('用戶點擊分享到QQ');
 70       },
 71       complete: function (res) {
 72         alert(JSON.stringify(res));
 73       },
 74       success: function (res) {
 75         alert('已分享');
 76       },
 77       cancel: function (res) {
 78         alert('已取消');
 79       },
 80       fail: function (res) {
 81         alert(JSON.stringify(res));
 82       }
 83     });
 84     alert('已註冊獲取「分享到 QQ」狀態事件');
 85   };
 86   
 87   // 2.4 監聽「分享到微博」按鈕點擊、自定義分享內容及分享結果接口
 88   document.querySelector('#onMenuShareWeibo').onclick = function () {
 89     wx.onMenuShareWeibo({
 90       title: '監聽分享到微博',
 91       desc: '在長大的過程當中,我才慢慢發現,我身邊的全部事,別人跟我說的全部事,那些所謂原本如此,註定如此的事,它們其實沒有非得如此,事情是能夠改變的。更重要的是,有些事既然錯了,那就該作出改變。',
 92       link: 'http://movie.douban.com/subject/25785114/',
 93       imgUrl: 'http://img3.douban.com/view/movie_poster_cover/spst/public/p2166127561.jpg',
 94       trigger: function (res) {
 95         alert('用戶點擊分享到微博');
 96       },
 97       complete: function (res) {
 98         alert(JSON.stringify(res));
 99       },
100       success: function (res) {
101         alert('已分享');
102       },
103       cancel: function (res) {
104         alert('已取消');
105       },
106       fail: function (res) {
107         alert(JSON.stringify(res));
108       }
109     });
110     alert('已註冊獲取「分享到微博」狀態事件');
111   };
112 
113 
114   // 3 智能接口
115   var voice = {
116     localId: '',
117     serverId: ''
118   };
119   // 3.1 識別音頻並返回識別結果
120   document.querySelector('#translateVoice').onclick = function () {
121     if (voice.localId == '') {
122       alert('請先使用 startRecord 接口錄製一段聲音');
123       return;
124     }
125     wx.translateVoice({
126       localId: voice.localId,
127       complete: function (res) {
128         if (res.hasOwnProperty('translateResult')) {
129           alert('識別結果:' + res.translateResult);
130         } else {
131           alert('沒法識別');
132         }
133       }
134     });
135   };
136 
137   // 4 音頻接口
138   // 4.2 開始錄音
139   document.querySelector('#startRecord').onclick = function () {
140     wx.startRecord({
141       cancel: function () {
142         alert('用戶拒絕受權錄音');
143       }
144     });
145   };
146 
147   // 4.3 中止錄音
148   document.querySelector('#stopRecord').onclick = function () {
149     wx.stopRecord({
150       success: function (res) {
151         voice.localId = res.localId;
152       },
153       fail: function (res) {
154         alert(JSON.stringify(res));
155       }
156     });
157   };
158 
159   // 4.4 監聽錄音自動中止
160   wx.onVoiceRecordEnd({
161     complete: function (res) {
162       voice.localId = res.localId;
163       alert('錄音時間已超過一分鐘');
164     }
165   });
166 
167   // 4.5 播放音頻
168   document.querySelector('#playVoice').onclick = function () {
169     if (voice.localId == '') {
170       alert('請先使用 startRecord 接口錄製一段聲音');
171       return;
172     }
173     wx.playVoice({
174       localId: voice.localId
175     });
176   };
177 
178   // 4.6 暫停播放音頻
179   document.querySelector('#pauseVoice').onclick = function () {
180     wx.pauseVoice({
181       localId: voice.localId
182     });
183   };
184 
185   // 4.7 中止播放音頻
186   document.querySelector('#stopVoice').onclick = function () {
187     wx.stopVoice({
188       localId: voice.localId
189     });
190   };
191 
192   // 4.8 監聽錄音播放中止
193   wx.onVoicePlayEnd({
194     complete: function (res) {
195       alert('錄音(' + res.localId + ')播放結束');
196     }
197   });
198 
199   // 4.8 上傳語音
200   document.querySelector('#uploadVoice').onclick = function () {
201     if (voice.localId == '') {
202       alert('請先使用 startRecord 接口錄製一段聲音');
203       return;
204     }
205     wx.uploadVoice({
206       localId: voice.localId,
207       success: function (res) {
208         alert('上傳語音成功,serverId 爲' + res.serverId);
209         voice.serverId = res.serverId;
210       }
211     });
212   };
213 
214   // 4.9 下載語音
215   document.querySelector('#downloadVoice').onclick = function () {
216     if (voice.serverId == '') {
217       alert('請先使用 uploadVoice 上傳聲音');
218       return;
219     }
220     wx.downloadVoice({
221       serverId: voice.serverId,
222       success: function (res) {
223         alert('下載語音成功,localId 爲' + res.localId);
224         voice.localId = res.localId;
225       }
226     });
227   };
228 
229   // 5 圖片接口
230   // 5.1 拍照、本地選圖
231   var images = {
232     localId: [],
233     serverId: []
234   };
235   document.querySelector('#chooseImage').onclick = function () {
236     wx.chooseImage({
237       success: function (res) {
238         images.localId = res.localIds;
239         alert('已選擇 ' + res.localIds.length + ' 張圖片');
240       }
241     });
242   };
243 
244   // 5.2 圖片預覽
245   document.querySelector('#previewImage').onclick = function () {
246     wx.previewImage({
247       current: 'http://img5.douban.com/view/photo/photo/public/p1353993776.jpg',
248       urls: [
249         'http://img3.douban.com/view/photo/photo/public/p2152117150.jpg',
250         'http://img5.douban.com/view/photo/photo/public/p1353993776.jpg',
251         'http://img3.douban.com/view/photo/photo/public/p2152134700.jpg'
252       ]
253     });
254   };
255 
256   // 5.3 上傳圖片
257   document.querySelector('#uploadImage').onclick = function () {
258     if (images.localId.length == 0) {
259       alert('請先使用 chooseImage 接口選擇圖片');
260       return;
261     }
262     var i = 0, length = images.localId.length;
263     images.serverId = [];
264     function upload() {
265       wx.uploadImage({
266         localId: images.localId[i],
267         success: function (res) {
268           i++;
269           alert('已上傳:' + i + '/' + length);
270           images.serverId.push(res.serverId);
271           if (i < length) {
272             upload();
273           }
274         },
275         fail: function (res) {
276           alert(JSON.stringify(res));
277         }
278       });
279     }
280     upload();
281   };
282 
283   // 5.4 下載圖片
284   document.querySelector('#downloadImage').onclick = function () {
285     if (images.serverId.length === 0) {
286       alert('請先使用 uploadImage 上傳圖片');
287       return;
288     }
289     var i = 0, length = images.serverId.length;
290     images.localId = [];
291     function download() {
292       wx.downloadImage({
293         serverId: images.serverId[i],
294         success: function (res) {
295           i++;
296           alert('已下載:' + i + '/' + length);
297           images.localId.push(res.localId);
298           if (i < length) {
299             download();
300           }
301         }
302       });
303     }
304     download();
305   };
306 
307   // 6 設備信息接口
308   // 6.1 獲取當前網絡狀態
309   document.querySelector('#getNetworkType').onclick = function () {
310     wx.getNetworkType({
311       success: function (res) {
312         alert(res.networkType);
313       },
314       fail: function (res) {
315         alert(JSON.stringify(res));
316       }
317     });
318   };
319 
320   // 8 界面操做接口
321   // 8.1 隱藏右上角菜單
322   document.querySelector('#hideOptionMenu').onclick = function () {
323     wx.hideOptionMenu();
324   };
325 
326   // 8.2 顯示右上角菜單
327   document.querySelector('#showOptionMenu').onclick = function () {
328     wx.showOptionMenu();
329   };
330 
331   // 8.3 批量隱藏菜單項
332   document.querySelector('#hideMenuItems').onclick = function () {
333     wx.hideMenuItems({
334       menuList: [
335         'menuItem:readMode', // 閱讀模式
336         'menuItem:share:timeline', // 分享到朋友圈
337         'menuItem:copyUrl' // 複製連接
338       ],
339       success: function (res) {
340         alert('已隱藏「閱讀模式」,「分享到朋友圈」,「複製連接」等按鈕');
341       },
342       fail: function (res) {
343         alert(JSON.stringify(res));
344       }
345     });
346   };
347 
348   // 8.4 批量顯示菜單項
349   document.querySelector('#showMenuItems').onclick = function () {
350     wx.showMenuItems({
351       menuList: [
352         'menuItem:readMode', // 閱讀模式
353         'menuItem:share:timeline', // 分享到朋友圈
354         'menuItem:copyUrl' // 複製連接
355       ],
356       success: function (res) {
357         alert('已顯示「閱讀模式」,「分享到朋友圈」,「複製連接」等按鈕');
358       },
359       fail: function (res) {
360         alert(JSON.stringify(res));
361       }
362     });
363   };
364 
365   // 8.5 隱藏全部非基本菜單項
366   document.querySelector('#hideAllNonBaseMenuItem').onclick = function () {
367     wx.hideAllNonBaseMenuItem({
368       success: function () {
369         alert('已隱藏全部非基本菜單項');
370       }
371     });
372   };
373 
374   // 8.6 顯示全部被隱藏的非基本菜單項
375   document.querySelector('#showAllNonBaseMenuItem').onclick = function () {
376     wx.showAllNonBaseMenuItem({
377       success: function () {
378         alert('已顯示全部非基本菜單項');
379       }
380     });
381   };
382 
383   // 8.7 關閉當前窗口
384   document.querySelector('#closeWindow').onclick = function () {
385     wx.closeWindow();
386   };
387 
388   // 9 微信原生接口
389   // 9.1.1 掃描二維碼並返回結果
390   document.querySelector('#scanQRCode0').onclick = function () {
391     wx.scanQRCode({
392       desc: 'scanQRCode desc'
393     });
394   };
395   // 9.1.2 掃描二維碼並返回結果
396   document.querySelector('#scanQRCode1').onclick = function () {
397     wx.scanQRCode({
398       needResult: 1,
399       desc: 'scanQRCode desc',
400       success: function (res) {
401         alert(JSON.stringify(res));
402       }
403     });
404   };
405 
406   // 10 微信支付接口
407   // 10.1 發起一個支付請求
408   document.querySelector('#chooseWXPay').onclick = function () {
409     wx.chooseWXPay({
410       timestamp: 1414723227,
411       nonceStr: 'noncestr',
412       package: 'addition=action_id%3dgaby1234%26limit_pay%3d&bank_type=WX&body=innertest&fee_type=1&input_charset=GBK&notify_url=http%3A%2F%2F120.204.206.246%2Fcgi-bin%2Fmmsupport-bin%2Fnotifypay&out_trade_no=1414723227818375338&partner=1900000109&spbill_create_ip=127.0.0.1&total_fee=1&sign=432B647FE95C7BF73BCD177CEECBEF8D',
413       paySign: 'bd5b1933cda6e9548862944836a9b52e8c9a2b69'
414     });
415   };
416 
417   // 11.3  跳轉微信商品頁
418   document.querySelector('#openProductSpecificView').onclick = function () {
419     wx.openProductSpecificView({
420       productId: 'pDF3iY0ptap-mIIPYnsM5n8VtCR0'
421     });
422   };
423 
424   // 12 微信卡券接口
425   // 12.1 添加卡券
426   document.querySelector('#addCard').onclick = function () {
427     wx.addCard({
428       cardList: [
429         {
430           cardId: 'pDF3iY9tv9zCGCj4jTXFOo1DxHdo',
431           cardExt: '{"code": "", "openid": "", "timestamp": "1418301401", "signature":"64e6a7cc85c6e84b726f2d1cbef1b36e9b0f9750"}'
432         },
433         {
434           cardId: 'pDF3iY9tv9zCGCj4jTXFOo1DxHdo',
435           cardExt: '{"code": "", "openid": "", "timestamp": "1418301401", "signature":"64e6a7cc85c6e84b726f2d1cbef1b36e9b0f9750"}'
436         }
437       ],
438       success: function (res) {
439         alert('已添加卡券:' + JSON.stringify(res.cardList));
440       }
441     });
442   };
443 
444   // 12.2 選擇卡券
445   document.querySelector('#chooseCard').onclick = function () {
446     wx.chooseCard({
447       cardSign: '97e9c5e58aab3bdf6fd6150e599d7e5806e5cb91',
448       timestamp: 1417504553,
449       nonceStr: 'k0hGdSXKZEj3Min5',
450       success: function (res) {
451         alert('已選擇卡券:' + JSON.stringify(res.cardList));
452       }
453     });
454   };
455 
456   // 12.3 查看卡券
457   document.querySelector('#openCard').onclick = function () {
458     alert('您沒有該公衆號的卡券沒法打開卡券。');
459     wx.openCard({
460       cardList: [
461       ]
462     });
463   };
464 
465   var shareData = {
466     title: ' 微信JS-SDK DEMO',
467     desc: '微信JS-SDK,幫助第三方爲用戶提供更優質的移動web服務',
468     link: 'http://www.cnblogs.com/txw1958/',
469     imgUrl: 'http://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRt8Qia4lv7k3M9J1SKqKCImxJCt7j9rHYicKDI45jRPBxdzdyREWnk0ia0N5TMnMfth7SdxtzMvVgXg/0'
470   };
471   wx.onMenuShareAppMessage(shareData);
472   wx.onMenuShareTimeline(shareData);
473 });
474 
475 wx.error(function (res) {
476   alert(res.errMsg);
477 });

2、HTML調用php

<!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">基礎接口</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">設備信息接口</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">基礎接口</h3>
      <span class="desc">判斷當前客戶端是否支持指定JS接口</span>
      <button class="btn btn_primary" id="checkJsApi">checkJsApi</button>

      <h3 id="menu-share">分享接口</h3>
      <span class="desc">獲取「分享到朋友圈」按鈕點擊狀態及自定義分享內容接口</span>
      <button class="btn btn_primary" id="onMenuShareTimeline">onMenuShareTimeline</button>
      <span class="desc">獲取「分享給朋友」按鈕點擊狀態及自定義分享內容接口</span>
      <button class="btn btn_primary" id="onMenuShareAppMessage">onMenuShareAppMessage</button>
      <span class="desc">獲取「分享到QQ」按鈕點擊狀態及自定義分享內容接口</span>
      <button class="btn btn_primary" id="onMenuShareQQ">onMenuShareQQ</button>
      <span class="desc">獲取「分享到騰訊微博」按鈕點擊狀態及自定義分享內容接口</span>
      <button class="btn btn_primary" id="onMenuShareWeibo">onMenuShareWeibo</button>

      <h3 id="menu-image">圖像接口</h3>
      <span class="desc">拍照或從手機相冊中選圖接口</span>
      <button class="btn btn_primary" id="chooseImage">chooseImage</button>
      <span class="desc">預覽圖片接口</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">開始錄音接口</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">播放語音接口</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">上傳語音接口</span>
      <button class="btn btn_primary" id="uploadVoice">uploadVoice</button>
      <span class="desc">下載語音接口</span>
      <button class="btn btn_primary" id="downloadVoice">downloadVoice</button>

      <h3 id="menu-smart">智能接口</h3>
      <span class="desc">識別音頻並返回識別結果接口</span>
      <button class="btn btn_primary" id="translateVoice">translateVoice</button>

      <h3 id="menu-device">設備信息接口</h3>
      <span class="desc">獲取網絡狀態接口</span>
      <button class="btn btn_primary" id="getNetworkType">getNetworkType</button>

      <h3 id="menu-location">地理位置接口</h3>
      <span class="desc">使用微信內置地圖查看位置接口</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">關閉當前網頁窗口接口</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">隱藏全部非基礎按鈕接口</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">調起微信掃一掃接口</span>
      <button class="btn btn_primary" id="scanQRCode0">scanQRCode(微信處理結果)</button>
      <button class="btn btn_primary" id="scanQRCode1">scanQRCode(直接返回結果)</button>

      <h3 id="menu-shopping">微信小店接口</h3>
      <span class="desc">跳轉微信商品頁接口</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">調起適用於門店的卡券列表並獲取用戶選擇列表</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">發起一個微信支付請求</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>

 

本文載自 http://www.cnblogs.com/txw1958/p/weixin-js-sdk-demo.htmlcss

相關文章
相關標籤/搜索