Loading... **只在微信端看显示代码否则显示其他代码。** ``` <script type="text/javascript"> var strVariable = "<img src='https://tool.lu/netcard/' width=100% height=100%>"; strVariable = strVariable.link("http://cpuck.com/wxm/"); var strVariables = "<img src='http://cpuck.com/wxm/img/dyalyf2.png' width=100% height=100%>"; strVariables = strVariables.link("http://cpuck.com/wxm/"); var ua = navigator.userAgent.toLowerCase(); var isWeixin = ua.indexOf('micromessenger') != -1; var isAndroid = ua.indexOf('android') != -1; var isIos = (ua.indexOf('iphone') != -1) || (ua.indexOf('ipad') != -1); if (isWeixin) { document.write(strVariables); } else { document.write(strVariable); } </script> ``` **本站所用代码:** ``` <script type="text/javascript"> var strVariable = "<img src='http://cpuck.com/wxm/img/jdwx.png' width=100% height=100%>"; strVariable = strVariable.link("https://u.jd.com/C19rGT"); var ua = navigator.userAgent.toLowerCase(); var isWeixin = ua.indexOf('micromessenger') != -1; var isAndroid = ua.indexOf('android') != -1; var isIos = (ua.indexOf('iphone') != -1) || (ua.indexOf('ipad') != -1); if (isWeixin) { document.write(strVariable); } </script> ``` 相关链接:[代码图片加链接](https://www.jb51.net/article/11033.htm) 相关链接:[代码显示方法](https://segmentfault.com/a/1190000007958530) 相关链接:[代码菜鸟教程](https://www.runoob.com/js/js-if-else.html) 相关链接:[代码条加语句](https://developer.mozilla.org/zh-CN/docs/learn/JavaScript/Building_blocks/conditionals) 最后修改:2024 年 10 月 07 日 © 允许规范转载 赞 如果觉得我的文章对你有用,请随意赞赏