index2.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf8">
  4. <script language="javascript">
  5. var ctuapp_share_img="www.baidu.com";
  6. function scanClick() {
  7. window.webkit.messageHandlers.ScanAction.postMessage(null);
  8. }
  9. function shareClick() {
  10. window.webkit.messageHandlers.shareClick.postMessage({title:'测试分享的标题',content:'测试分享的内容',url:'http://m.rblcmall.com/share/openShare.htm?share_uuid=shdfxdfdsfsdfs&share_url=http://m.rblcmall.com/store_index_32787.htm&imagePath=http://c.hiphotos.baidu.com/image/pic/item/f3d3572c11dfa9ec78e256df60d0f703908fc12e.jpg'});
  11. }
  12. function locationClick() {
  13. window.webkit.messageHandlers.Location.postMessage(null);
  14. }
  15. function setLocation(location) {
  16. asyncAlert(location);
  17. document.getElementById("returnValue").value = location;
  18. }
  19. function getQRCode(result) {
  20. asyncAlert(result);
  21. document.getElementById("returnValue").value = result;
  22. }
  23. function colorClick() {
  24. window.webkit.messageHandlers.Color.postMessage([67,205,128,0.5]);
  25. }
  26. function payClick() {
  27. window.webkit.messageHandlers.Pay.postMessage({order_no:'201511120981234',channel:'wx',amount:1,subject:'粉色外套'});
  28. }
  29. function payResult(str) {
  30. asyncAlert(str);
  31. document.getElementById("returnValue").value = str;
  32. }
  33. function shareResult(channel_id,share_channel,share_url) {
  34. var content = channel_id+","+share_channel+","+share_url;
  35. asyncAlert(content);
  36. document.getElementById("returnValue").value = content;
  37. }
  38. function shake() {
  39. window.webkit.messageHandlers.Shake.postMessage(null);
  40. }
  41. function goBack() {
  42. window.webkit.messageHandlers.GoBack.postMessage(null);
  43. }
  44. function playSound() {
  45. window.webkit.messageHandlers.PlaySound.postMessage('shake_sound_male.wav');
  46. }
  47. function asyncAlert(content) {
  48. setTimeout(function(){
  49. alert(content);
  50. },1);
  51. }
  52. </script>
  53. </head>
  54. <body>
  55. <h1>这是按钮调用</h1>
  56. <input type="button" value="扫一扫" onclick="scanClick()" />
  57. <input type="button" value="获取定位" onclick="locationClick()" />
  58. <input type="button" value="修改背景色" onclick="colorClick()" />
  59. <input type="button" value="分享" onclick="shareClick()" />
  60. <input type="button" value="支付" onclick="payClick()" />
  61. <input type="button" value="摇一摇" onclick="shake()" />
  62. <input type="button" value="返回" onclick="goBack()" />
  63. <input type="button" value="播放声音" onclick="playSound()" />
  64. <h1>这是文件上传</h1>
  65. <input type="file" />
  66. <h1>这是回调结果展示区</h1>
  67. <textarea id ="returnValue" type="value" rows="5" cols="40">
  68. </textarea>
  69. <h4>竖直方向的表头:</h4>
  70. <table border="1" style="width:90%;height:600px">
  71. <tr>
  72. <th>姓名</th>
  73. <td>Bill Gates</td>
  74. </tr>
  75. <tr>
  76. <th>电话</th>
  77. <td>555 77 854</td>
  78. </tr>
  79. <tr>
  80. <th>传真</th>
  81. <td>555 77 855</td>
  82. </tr>
  83. </table>
  84. </body>
  85. </html>