码迷,mamicode.com
首页 > Web开发 > 详细

获取URL传进来的参数,法定节假日或者平时周末(排除补假)显示、隐藏电话号码

时间:2016-01-18 21:05:00      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:电话

http://www.4008000000.com/m/cpchexian/campaign/waimei/IBhuokechanggui-weizhang.shtml

http://www.4008000000.com/m/cpchexian/campaign/waimei/IBhuokechanggui-ershouche.shtml

http://www.4008000000.com/m/cpchexian/campaign/waimei/IBhuokechanggui-xinche.shtml

http://www.4008000000.com/m/cpchexian/campaign/waimei/IBhuokechanggui-fuwu.shtml





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>平安车险,来电报价送移动电源!</title>

<meta name="keywords" content="车险 汽车保险 车辆保险" />

<meta name="description" content="平安车险,来电报价送移动电源!" />

<meta http-equiv="content-language" content="zh-cn" />

<meta http-equiv="x-ua-compatible" content="ie=emulateie7" />

<meta name="copyright" content="本页版权归中国平安所有。All Rights Reserved" />

<meta name="author" content="中国平安" />

<meta content="yes" name="apple-mobile-web-app-capable" />

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />

<meta content="black-translucent" name="apple-mobile-web-app-status-bar-style" />

<meta content="telephone=no" name="format-detection" />

<link rel="stylesheet" href="http://pcss1.4008000000.com/app_css/4008000000/youhui/m/cpchexian/campaign/waimei/ib.css" type="text/css" />

</head>


<body>

<header class="header">

<div class="header_m">

<img src="http://pimg1.4008000000.com/app_images/4008000000/youhui/m/cpchexian/campaign/waimei/ib/logo.png" class="logo" alt="logo" width="278" height="24" />

<span class="sign">保险·银行·投资</span>

</div>

</header>


<section class="banner">

<img src="/app_images/4008000000/youhui/m/cpchexian/campaign/waimei/ib/banner_weizhang.jpg" alt="平安车险,来电报价送移动电源!" width="640" height="360" />

</section>


<section class="pro_msg">

<!-- 江西、湖南、湖北、黑龙江、山东含青岛、广西、重庆、陕西不参加活动 -->

</section>


<section class="btn_part">

<a href="tel:400-920-6801" class="contact_btn" id="T-contact" data-size=".33" title="拨打400-920-6801" otitle="拨打400-920-6801" otype="button">

<!-- <span class="cj_ico cj_ico_phone"></span>

<span class="line"></span> -->

<span id="T-contact-mobile" class="tel">点击拨打 400-920-6801</span>

</a>

<!-- <a href="" class="baojia_btn" id="T-zaixianbaojia" title="在线报价" otitle="在线报价" otype="button">在线报价</a> -->

</section>


<section class="form_list">

<h2>平安车险计算器</h2>

<div class="mobWrapper"></div>

</section>


<footer class="footer">

<p class="p1">

<span class="s1">买车险,上官网就够了>></span>

<span class="s2"><a href="http://www.4008000000.com" target="_blank" id="T-4008" title="4008官网" otitle="4008官网" otype="button">www.4008000000.com</a></span>

</p>

<p class="p2">

<a href="#" id="T-shoujiban" title="手机版" otitle="手机版" otype="button">手机版</a> | <a href="http://www.4008000000.com/zaixiangoumai/chexian/chexian.shtml?inner_media=baojiakuang-liaojiechexian" id="T-zhuomianban" title="桌面版" otitle="桌面版" otype="button">桌面版</a>

</p>

<p class="p3">copyright@2015 平安直通保险 - 关于平安</p>

</footer>


<!-- START: 公用底部 -->

<script type="text/javascript" src="http://pscript1.4008000000.com/app_js/paui/1.0.1/build/pa.ui.min.js"></script>

<script type="text/javascript"> 

var _hmt = _hmt || [];

(function(){

function getParams(name) {

    var reg = new RegExp(‘(^|&)‘ + name + ‘=([^&]*)(&|$)‘, ‘i‘);

    var r = window.top.location.search.substr(1).match(reg);

    if(r) {

        return decodeURI(r[2]);

    }

    return null;

}

var mobile_num = getParams(‘mobile‘) || "400-920-6801",

mobile="点击拨打 " + mobile_num,

$T_contact = $(‘#T-contact‘),

$T_contact_mobile = $(‘#T-contact-mobile‘);

$T_contact.attr({‘href‘:‘tel:‘ + mobile_num,‘title‘:‘拨打‘ + mobile,‘otitle‘:‘拨打‘ + mobile});

$T_contact_mobile.text(mobile);


$T_contact.bind("click",function(){

_hmt.push([‘_trackEvent‘, "ib", "tel", mobile]);

});


// 显隐电话号码

var date=new Date();

   //法定节假日

   var legalDay=["2016/1/1","2016/2/8","2016/2/9","2016/2/10","2016/2/11","2016/2/12","2016/4/4","2016/5/2","2016/6/9","2016/6/10","2016/9/15","2016/9/16","2016/10/3","2016/10/4","2016/10/5","2016/10/6","2016/10/7"];

   var legalDayFlag=legalDay.some(function(elem,index,arr){

         return legalDay==date.toLocaleDateString();

   });

   //补假

   var fillHolidays=["2016/2/6","2016/2/14","2016/6/12","2016/9/18","2016/10/8","2016/10/9"];

   var fillHolidaysFlag=fillHolidays.some(function(elem,index,arr){

         return fillHolidays==date.toLocaleDateString();

   });

   

   //法定节假日或者平时周末(排除补假)

   if(legalDayFlag || (!fillHolidaysFlag && date.getDay()==0 || date.getDay()==6)){

      if((date.getHours()==8 && date.getMinutes()>=30) || (date.getHours()>8 && date.getHours()<=18)){

         //显示电话号码

         $T_contact.show();

      }else{

         //隐藏电话号码

         $T_contact.hide();

      }

   }else{

      //上午8点至晚上20点(包括补假)

      if(date.getHours()>=8 && date.getHours()<=19){

         //显示电话号码

         $T_contact.show();

      }else{

         //隐藏电话号码

         $T_contact.hide();

      }

   }

})();


$(".mobWrapper").load("/ebusiness/car/mobile/quoter/insureBaseInfoCore.html");


function fontAni(){

var fon = $(‘.contact_btn‘).data(‘size‘);

if(fon == .33){

$(‘.contact_btn‘).css(‘font-size‘,‘.38rem‘).data(‘size‘,‘.38‘);

}else{

$(‘.contact_btn‘).css(‘font-size‘,‘.33rem‘).data(‘size‘,‘.33‘);

}

}

setInterval(fontAni,300);


    setTimeout(‘exesdcjs()‘,0);

    function exesdcjs(){

var jDomain="www.4008000000.com";

var js_path="/app_js/sdc/src/400.js";

var domain="http"+(window.location.protocol.indexOf(‘https:‘)==0?‘s‘:‘‘)+"://"+jDomain;

var SDC_js=document.createElement("script");

SDC_js.src=domain+js_path;

var headElem=document.getElementsByTagName("head")[0];

headElem.appendChild(SDC_js);   

    }

 

(function() {

var hm = document.createElement("script");

hm.src = "//hm.baidu.com/hm.js?2f53c35010dbe120000b9a32bd028225";

var s = document.getElementsByTagName("script")[0]; 

s.parentNode.insertBefore(hm, s);

})();

</script>

<!-- END: 公用底部 -->

<link rel="stylesheet" href="http://pcss1.4008000000.com/app_css/4008000000/youhui/m/cpchexian/campaign/waimei/ib.css" type="text/css" />

</body>

</html>


获取URL传进来的参数,法定节假日或者平时周末(排除补假)显示、隐藏电话号码

标签:电话

原文地址:http://iicoo.blog.51cto.com/10739372/1736178

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!