(function(){
var map = {
'index' : 0, 'gift_code' : 1,
'base_info' : 1,
'band_phone': 1,
'unlink_phone': 1, } function isSelect(idx){
var pathname = location.pathname;
pathname = pathname.split('/')[2];
return map[pathname] != idx ? ' <li>' : ' <li class="selected">'
}
document.write('<div class="menus">');
document.write(' <ul class="menu_ul">');
document.write(isSelect(0));
document.write(' <a href="/xycenter/index/" class="su_nav">首页</a>');
document.write(' </li>');
document.write(' <li>');
document.write(' <a href="/safecenter/index/" class="su_nav has_sub" target="_blank">安全中心<i></i></a>');
document.write(' <div class="sub_menu">');
document.write(' <a href="/safecenter/lock_index/" class="sub_nav">安全锁定</a>');
document.write(' <a href="/safecenter/change_pwd_by_phone/" class="sub_nav">密码管理</a>');
document.write(' <a href="/safecenter/safe_fdmj/" class="sub_nav">防盗秘籍</a>');
document.write(' </div>');
document.write(' </li>');
document.write(' <li>');
document.write(' <a href="/callcenter/index/" class="su_nav has_sub" target="_blank">客服中心<i></i></a>');
document.write(' <div class="sub_menu">');
document.write(' <a href="/callcenter/self_help/" class="sub_nav" target="_self">自助服务</a>');
document.write(' <a href="/callcenter/helps/" class="sub_nav">帮助</a>');
document.write(' </div>');
document.write(' </li>');
document.write(isSelect(1));
document.write(' <a href="/usercenter/gift_code/" class="su_nav">我的帐户</a>');
document.write(' </li>');
document.write(' </ul>');
document.write('</div>');
document.write('<a href="javascript:;" class="su_logo">');
document.write(' <img style="width:250px;"src="abc.png" />');
document.write('</a>');
})();

另一种方式:

(function(){
document.write('<div class="links" id="uc_links">');
document.write(' <div class="link">');
document.write(' <a href=""><i></i><span>基本资料</span></a>');
document.write(' </div>');
document.write(' <div class="link">');
document.write(' <a href=""><i></i><span>礼包码</span></a>');
document.write(' </div>');
document.write(' <div class="link">');
document.write(' <a href=""><i></i><span>手机绑定</span></a>');
document.write(' </div>');
document.write(' <div class="link">');
document.write(' <a href=""><i></i><span>手机解绑</span></a>');
document.write(' </div>');
document.write('</div>'); var pathname = location.pathname;
pathname = pathname.split('/')[2];
var linksCon = document.getElementById('uc_links');
var links = linksCon.getElementsByTagName('a') , len = links.length;
if(pathname){
var sub;
for(var i=0;i<len;i++){
if(links[i].getAttribute('href').indexOf(pathname) != -1){
links[i].parentNode.className = 'link select_page';
}
}
}else{
links[0].parentNode.className = 'link select_page';
}
})();

js 网站顶部导航栏的更多相关文章

  1. 用Vue来实现音乐播放器(五):路由配置+顶部导航栏组件开发

    路由配置 在router文件夹下的index.js中配置路由 import Vue from 'vue' import Router from 'vue-router'//配置路由前先引入组件impo ...

  2. android开发(49) android 使用 CollapsingToolbarLayout ,可折叠的顶部导航栏

    概述 在很app上都见过 可折叠的顶部导航栏效果.google support v7  提供了 CollapsingToolbarLayout 可以实现这个效果.效果图如下:    实现步骤 1. 写 ...

  3. [置顶] xamarin Tablayout+Viewpager+Fragment顶部导航栏

    最近几天不忙,所以把项目中的顶部导航栏的实现归集一下.android中使用TabLayout+ViewPager+Fragment制作顶部导航非常常见,代码实现也比较简单.当然我这个导航栏是基于xam ...

  4. 使用PagerSlidingTabStrip实现顶部导航栏

    使用PagerSlidingTabStrip配合ViewPager实现顶部导航栏. 效果图如下:          PagerSlidingTabStrip是github上的一个开源项目,项目地址如下 ...

  5. Android之仿今日头条顶部导航栏效果

    随着时间的推移现在的软件要求显示的内容越来越多,所以要在小的屏幕上能够更好的显示更多的内容,首先我们会想到底部菜单栏,但是有时候像今日头条新闻客户端要显示的内容太多,而且又想在主界面全部显示出来,所以 ...

  6. 【React -- 9/100】 抽离顶部导航栏 - [组件复用]

    今天写的页面中需要重复使用到顶部导航栏,所以把顶部导航栏抽离出来 考虑复用组件的健壮性,使用PropTypes校验,可以自定义一个click事件 JSX import React from " ...

  7. uni-app 去除顶部导航栏

    自学uni-app第一天,因为有一点点的小程序和vue的基础所以感觉对uni-app有一点点的亲切感,从今天呢开始着手从登录页学习uni-app,记录一些用到的知识点,欢迎大家一起学习. 启动页隐藏顶 ...

  8. Vant 顶部导航栏【van-tabs】Bug

    Vant 顶部导航栏[van-tabs]Bug 如果在外面包裹div控制显示隐藏会出现导航条不准确的bug 代码 <div class="selWrap" v-show=&q ...

  9. uni-app动态修改顶部导航栏标题

    动态修改顶部导航栏标题有两种方法方式一.使用自定义到导航栏,覆盖原生导航栏 缺点:自定义到导航栏性能远远不如原生导航栏,手机顶部状态栏区域会被页面内容覆盖,这是因为窗体是沉浸式的原因,即全屏可写内容: ...

随机推荐

  1. EntityFramework Core 学习笔记 —— 包含与排除属性

    原文地址:https://docs.efproject.net/en/latest/modeling/included-properties.html 在模型中包含一个属性意味着 EF 拥有了这个属性 ...

  2. fidder 使用教程

    fidder 使用教程 1. Fiddler 是什么? Fiddler是用C#编写的一个免费的HTTP/HTTPS网络调试器.英语中Fiddler是小提琴的意思,Fiddler Web Debugge ...

  3. R绘图基础

    一,布局 R绘图所占的区域,被分成两大部分,一是外围边距,一是绘图区域. 外围边距可使用par()函数中的oma来进行设置.比如oma=c(4,3,2,1),就是指外围边距分别为下边距:4行,左边距3 ...

  4. [问题2015S07] 复旦高等代数 II(14级)每周一题(第八教学周)

    [问题2015S07]  设 \(A\) 为 \(n\) 阶复方阵, 证明: 存在 \(n\) 阶非异复对称阵 \(S\), 使得 \(A'=S^{-1}AS\), 即 \(A\) 可通过非异复对称阵 ...

  5. StudyFoxCMS-6

    1.phpstrom中安装emmet File=>Settings=>Plugins=>右侧搜索框搜索“emmet”=>点击下方中间按钮“Browse repositories ...

  6. SQL疑难杂症【5 】大量数据查询的时候要考虑结果为空的情况

    最近几天怪事儿出奇的多,同一个工单.同一个产品,在A线可以正常生产,但是在H线死活都无法生产,系统直接提示TimeOut,监控发现有一条SQL语句执行缓慢,Copy出来仔细查看,很简单的一条语句,如下 ...

  7. Java 输入输出流 转载

    转载自:http://blog.csdn.net/hguisu/article/details/7418161 1.什么是IO Java中I/O操作主要是指使用Java进行输入,输出操作. Java所 ...

  8. win10离线安装.net framework 3.5

    1.挂载win10系统镜像 2.执行命令 Dism /online /enable-feature /featurename:NetFX3 /All /Source:I:\sources\sxs /L ...

  9. Keycode对照表

    字母和数字键的键码值(keyCode) 按键 键码 按键 键码 按键 键码 按键 键码 A 65 J 74 S 83 1 49 B 66 K 75 T 84 2 50 C 67 L 76 U 85 3 ...

  10. label for

      一般我们在使用radio 时都是结合label来使用的 <label><input type=”radio” name=”radio” value=’0’/>男</l ...