暂无描述

first.html 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="yes" name="apple-mobile-web-app-capable">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
  7. <title></title>
  8. <link rel="stylesheet" type="text/css" href="../public/public_css.css"/>
  9. <style type="text/css">
  10. body{min-height:100vh;width: 100%;height: 100vh;background:#f81131 url(images/bg.png) no-repeat;background-size: 100%;}
  11. .container{width: 100%;height: 5.25rem;background: url(images/bg02.png) no-repeat;background-size: 102%;position: relative; top: 1.44rem;}
  12. .container .step{display: block;height: 1.14rem;padding-top: 1.2rem;padding-bottom:0.35rem;font-size: 0.22rem;color: #FFFFFF;line-height: 0.38rem;text-align: left;padding-left: 0.55rem;}
  13. .container .copy{width:2.37rem;height:0.62rem;background:#FFD726;border-radius:0.31rem;margin: auto;font-size: 0.27rem;line-height: 0.62rem;text-align: center;color: #E70220; box-shadow: 0px 0px 0.08rem 0.02rem rgba(0,0,0,0.2);}
  14. .container .union{width: 100%;height: auto;padding-top: 0.4rem;}
  15. .container .union img{width: 1.42rem; margin: auto;}
  16. .container .union p{letter-spacing: 0.01rem;font-size: 0.2rem; color: #FFFFFF;text-align: center;padding-top: 0.09rem;}
  17. #copy_1,#copy_2,#taokouling{position: absolute;left: -1000rem;}
  18. .alert-info {position: absolute;top: 1.74rem; right: 0; left: 0;bottom: 0; text-align: center;z-index: 99;}
  19. .alert-info p {display: inline-block;height: 0.38rem;color: #fff;font-size: 0.14rem;line-height: 0.38rem;padding: 0 0.10rem;background-color: rgba(0, 0, 0, 0.7);border-radius: 5px;}
  20. </style>
  21. <script type="text/javascript">
  22. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  23. window.onresize = function(){
  24. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  25. }
  26. </script>
  27. </head>
  28. <body>
  29. <div class="container">
  30. <p class="step">Step1:点击复制淘口令 <br/>Step2:打开淘宝领取红包</p>
  31. <div class="copy" onclick="copyPassword(),showMsg()">复制淘口令</div>
  32. <!--<div class="union"><img src="images/001.png"/><p>联合送礼 </p></div>-->
  33. </div>
  34. <input id="copy_1" type="text" readOnly="true" value=""/>
  35. <div id="copy_2"></div>
  36. <text id="taokouling">€isRtbeg93wO€</text>
  37. <div class="alert-info" style="display: none;">
  38. <!-- tip提示,2s后消失 -->
  39. <p></p>
  40. </div>
  41. </body>
  42. </html>
  43. <script type="text/javascript" src="../public/jquery-2.1.0.js"></script>
  44. <script type="text/javascript">
  45. function showMsg() {
  46. var msg = "复制成功";
  47. var msgBox = $('.alert-info');
  48. msgBox.children('p').text(msg);
  49. msgBox.show();
  50. setTimeout(function() {
  51. msgBox.hide();
  52. }, 2000);
  53. }
  54. function copyPassword() {
  55. var data=document.getElementById("taokouling").innerHTML;
  56. copy_2.innerHTML = data;
  57. copy_1.value = data;
  58. if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
  59. //区分iPhone设备
  60. window.getSelection().removeAllRanges();//这段代码必须放在前面否则无效
  61. var Url2=document.getElementById("copy_2");//要复制文字的节点
  62. var range = document.createRange();
  63. // 选中需要复制的节点
  64. range.selectNode(Url2);
  65. // 执行选中元素
  66. window.getSelection().addRange(range);
  67. // 执行 copy 操作
  68. var successful = document.execCommand('copy');
  69. // 移除选中的元素
  70. window.getSelection().removeAllRanges();
  71. }else{
  72. var Url2=document.getElementById("copy_1");//要复制文字的节点
  73. Url2.select(); // 选择对象
  74. document.execCommand("Copy"); // 执行浏览器复制命令
  75. }
  76. }
  77. </script>