点击的时候直接跳转到 微信界面


唤醒微信

<a href="weixin://">微信app</a>  //app  

页面布局

<div class="fl" style="width:80%; text-align:left; line-height:25px;">
    <div class="center" style="color:#FFF; font-size:14px;">
       微信号
     <b style="color:#f5cc26;font-size:14px;" id="yq">fxbcici</b>
     <a href="#" οnclick="" id="a1" style="display: inline-block;">
<img id="a2" style="line-height:25px;margin-left:5px;cursor:pointer;" src="picture/3.png" width="80">
     </a>
    </div>
</div>

js代码

<script type="text/javascript">
    $(function(){
/*给标签添加跳转路径*/
          var url = "weixin://";
         $('#a1').attr('href',url)
         var lj = "PIWI_SUBMIT.Weixin_Open()";
         $('#a1').attr('onclick',lj);
 /*封装函数复制内容*/        
 function copyArticle99(event){
        const range = document.createRange();
        range.selectNode(document.getElementById('yq'));
        console.log(range.selectNode(document.getElementById('yq')))
        const selection = window.getSelection();
        if(selection.rangeCount > 0) selection.removeAllRanges();
        selection.addRange(range);
/*复制成功的提示*/   
        document.execCommand('copy');alert("已复制好,可打开微信粘贴。"); 
    }
    /*通过事件监听的冒泡原理 显示点击提示之后的的跳转*/  
 document.getElementById('yjcopy').addEventListener('click', copyArticle99, false);
    })
</script>
正文完

评论区
个人资料

  • 博主木木
  • 运营天数2944
  • 文章阅读数 13612
  • 评论数量1
  • 文章数量83
搜索

倒计时