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>

猜你喜欢

  • 获取 10个分类下 每个分类最新的10篇文章<!--{iCMS:category:list loop="true" row="10"}--> <a href="<!--{$category_list.url}-->"><!--{$category_list.title}--></a>  <!--{iCMS:article:list loop="true" row="10" cid="$category_list.cid"}-->    <a href="<!--{$article_list.url}-->&quo

    ICMS2020-01-20
  • 一般的文字截断(适用于内联与块):.text-overflow {     display:block;/*内联对象需加*/     width:31em;/*指定宽度*/     word-break:keep-all;/* 不换行 */

    CSS2020-04-13
  •     <!-- 声明文档使用的字符编码 -->     <meta charset='utf-8'>     <!-- 优先使用 IE 最新版本和 Chrome -->     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>

    html相关标签2020-07-06
  • <ul><!--{iCMS:article:list loop="true" row="20" }-->    <!--{if $article_list.first}--><li><!--{/if}-->    <!--{"$article_list.index % 2"}-->        <span><!--{$article_list.title}--></span>    <!--{if $article_list.index % 2}-->        <

    ICMS2020-07-13
  • CSS3 :nth-child() 选择器 定义和用法: :nth-child(n) 选择器匹配属于其父元素的第 N 个子元素,不论元素的类型。 n 可以是数字、关键词或公式。

    CSS2020-07-21