|
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
- <title>免费巴士自由行 | 蜘蛛免单 VOL.1</title>
- <style type="text/css">
- *{margin:0px;padding: 0px;font-family: "黑体";}
- .main{width:100%;overflow: hidden;}
- .jiangpin{width:100%;height: 183px;margin-bottom: 5px;}
- .shuoming{width:100%;text-align: center;font-size: 14px;margin-bottom: 5px;}
- .tishi{width: 100%;text-align: center;font-size: 16px;margin-top:10px;}
- .xianleft{position:absolute;height: 2px;background: #E2E2E2;width:60px;left:3.5%;top:9px;}
- .xianright{position:absolute;height: 2px;background: #E2E2E2;width:60px;right:3.5%;top:9px;}
- .moblie{width:100%;text-align: center;margin-top:20px;}
- .moblie span{font-size: 16px;}
- #moblienum{width: 38%;height: 20px;border:2px solid #CCCCCC;border-radius: 5px;padding-left: 1em;font-size:15px;}
- .ps{margin-left:3.5%;margin-right: 3.5%;text-align: center;color:#9d9d9d;margin-top:13px;line-height: 22px;margin-bottom:50px;}
- .anniu{width: 100%;margin:auto;height: 40px;color: #FFFFFF;background: #33d6b0;text-align: center;line-height: 40px;font-size: 18px;position: fixed;bottom:0px;}
- </style>
- <!-- 百度统计star -->
- <script>
- var _hmt = _hmt || [];
- (function() {
- var hm = document.createElement("script");
- hm.src = "//hm.baidu.com/hm.js?3d4ede42cef05a99fcd8bda849831ada";
- var s = document.getElementsByTagName("script")[0];
- s.parentNode.insertBefore(hm, s);
- })();
- </script>
-
-
- <!-- 百度统计end -->
-
- </head>
- <body id="body">
- <div class="main" id="main" >
- <img class="jiangpin" src="img/qiandaohu.jpg"/>
- <div class="shuoming">千岛湖</div>
- <img class="jiangpin" src="img/fo3.jpg"/>
- <div class="shuoming">普陀山</div>
- <div style="position: relative;">
- <div class="xianleft"></div>
- <div class="tishi">请输入手机号参与报名</div>
- <div class="xianright"></div>
- </div>
- <input type="hidden" id="yonghuid" value=""/>
- <div class="moblie">
- <span>手机号</span>
- <input id="moblienum" type="text" />
- </div>
- <div class="ps">中奖信息将发至手机,请如实填写!</div>
- <div class="anniu" id="anniu" >参加抽奖</div>
- </div>
- </body>
- <script>
- var moblienum=document.getElementById("moblienum");
- var yonghuid=document.getElementById("yonghuid");
- var myform=document.getElementById("myform");
- var anniu=document.getElementById("anniu");
- var regtel=/(13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}|170[059]\d{7}/;
- anniu.onclick=function(){
- if(regtel.test(moblienum.value)&&moblienum.value.length==11){
- var str = moblienum.value;
- var openid = yonghuid.value;
- // var xhr = new XMLHttpRequest();
- // xhr.open("POST","http://xmwxc.zhizhuchuxing.cn/wechat/jssdk/lotteryinfo.php?openidtel="+str,true);
- // xhr.send(null);
- // xhr.onload = function(){
- // console.log(xhr.responseText);
- ajax({
- method : 'post',
- url : 'http://xmwxc.zhizhuchuxing.cn/wechat/jssdk/lotteryinfo.php',
- data : str+openid,
- //data : {str:str,aa:openid},
- success : function (text) {
- var jieguo=JSON.parse("text")
- if(jieguo.errorcode==0){
- alert(jieguo.errorinfo);
- window.location.href = "http://xmwxc.zhizhuchuxing.cn/wechat/jssdk/lotteryinfo.php";
- }else{
- alert(jieguo.errorinfo);
- }
- },
- async : true
- });
- }
- else{
- alert("请输入正确手机号!");
- return false;
- }
- }
-
- function createXHR() {
- if (typeof XMLHttpRequest != 'undefined') {
- return new XMLHttpRequest();
- } else if (typeof ActiveXObject != 'undefined') {
- var version = [
- 'MSXML2.XMLHttp.6.0',
- 'MSXML2.XMLHttp.3.0',
- 'MSXML2.XMLHttp'
- ];
- for (var i = 0; version.length; i ++) {
- try {
- return new ActiveXObject(version[i]);
- } catch (e) {
- //跳过
- }
- }
- } else {
- throw new Error('您的系统或浏览器不支持XHR对象!');
- }
- }
-
- function ajax(obj) {
- var xhr = createXHR();
- obj.url = obj.url + '?rand=' + Math.random();
-
- //console.log(obj.data)
- if (obj.method === 'get') obj.url += obj.url.indexOf('?') == -1 ? '?' + obj.data : '&' + obj.data;
- if (obj.async === true) {
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4) {
- callback();
- }
- };
- }
- xhr.open(obj.method, obj.url, obj.async);
- if (obj.method === 'post') {
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xhr.send(obj.data);
- } else {
- xhr.send(null);
- }
- if (obj.async === false) {
- callback();
- }
- function callback() {
- if (xhr.status == 200) {
- obj.success(xhr.responseText); //回调传递参数
- } else {
- alert('获取数据错误!错误代号:' + xhr.status + ',错误信息:' + xhr.statusText);
- }
- }
- }
-
- //名值对转换为字符串
- function params(data) {
- var arr = [];
- for (var i in data) {
- arr.push(encodeURIComponent(i) + '=' + encodeURIComponent(data[i]));
- }
- return arr.join('&');
- }
-
- </script>
- </html>
|