自定义百度竞价电话回拨样式总结

昨天搞了一下午没有头绪,今天特意马克上来以作备用。

<form name="f" id="f" method="post" action="/" target="aa"
  <input type="hidden" name="fromurl" id="call_fromurl" value="" />
  <input type="hidden" name="sid" value="">
  <input type="hidden" name="did" value="">
  <input name="tel" id="telInput" class="text" type="text" />
  <input style="border:none;" class="tel_button"  type="submit" id="callBtn" name="Submit" value="免费通话">
</form>
<iframe name="aa" id="aa" frameborder="0" width="0" height="0"></iframe>
<script>
  document.getElementById("callBtn").onclick = function () {
  lxb.call(document.getElementById("telInput"));
  };
</script>
<script>
document.write('<script type="text/javascript"  data-lxb-uid="关键值(后台获取)" data-lxb-gid="关键值(后台获取)" src="http://lxbjs.baidu.com/api/asset/api.js?t=' + new Date().getTime() + '" charset="utf-8"></scr' + 'ipt>' );
</script>
<script>var ref="";if(document.referrer.length>0){ref=document.referrer}try{if(ref.length==0&&opener.location.href.length>0){ref=opener.location.href}}catch(e){ref=window.location.href}if(window.location.href=="/js/swtiframe.html"){ref=ref+"?来自弹窗"}document.getElementById("call_fromurl").value=ref;</script> 

这样就可以绕过百度后台的几种样式,通过自定义的class来改变回拨界面了。

原文地址:https://www.cnblogs.com/wangjiayi/p/4834259.html