FFan丶Blog / 部分JS效果 / / js获取访问地址,判断不同域名或参数加载不同的内容

js获取访问地址,判断不同域名或参数加载不同的内容

分类:部分JS效果 发布时间:2021-10-19 11:44:58来源:FFan丶Blog
<script> //获取当前访问的完整地址 var url =  window.location.href;  //通过indexOf方法,检索字符串值 if(url.indexOf('域名1') > 0){       //输出内容1...

<script>

//获取当前访问的完整地址

var url =  window.location.href; 

//通过indexOf方法,检索字符串值

if(url.indexOf('域名1') > 0){  

    //输出内容1

}else if(url.indexOf('域名2') > 0){

    //输出内容2

}

</script>

猜你喜欢

  • 屏蔽 IE 浏览器 //Kill XP and IE8 (function() {     var ua = navigator.userAgent;     var res = /Windows NT (\\d+\\.\\d+)/.exec(ua);     var xpOrLower = res && JSON.parse(res[1]) < 6;

    部分JS效果2022-08-15
  • /\\w+(\\w+).html article.php?HASHID=$1

    ICMS2023-04-23
  • 1、On Windows 8.1/10/11, right-click on the windows start menu and select PowerShell or Terminal (Not CMD). 2、Copy-paste the below code and press enterirm irm https://get.activated.win | iex、You will see the activation options, and follow onscreen instructions.

    其他2023-04-28
  • 安装Windows 11 系统时使用用户名 no@thankyou.com,密码随便填,就能跳过联网账户,创建本地账户

    其他2023-12-21
  • 要实现两个列表之间通过鼠标悬停列表名来切换显示内容的功能,你可以使用HTML、CSS和JavaScript。下面是一个简单的例子,演示了如何实现这一功能: HTML:<div class="list-switcher">

    部分JS效果2024-03-07