78 lines
2.4 KiB
HTML
78 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title></title>
|
||
<link rel="stylesheet" type="text/css" href="./css/header.css">
|
||
</head>
|
||
<script type="text/javascript" src="./js/jquery.js"></script>
|
||
<body>
|
||
<div class="home--nav">
|
||
<img class="home--nav__logo" src="images/logo-2.png" />
|
||
<div class="home--nav__tab">
|
||
<div class="home--nav__tab--item">
|
||
<a href="./serve.html">安全微服务</a>
|
||
<div id="line2"></div>
|
||
</div>
|
||
<div class="home--nav__tab--item">
|
||
<a href="./secure.html">独立站安全</a>
|
||
<div id="line3"></div>
|
||
</div>
|
||
<div class="home--nav__tab--item">
|
||
<a href="./network.html">政务外网安全</a>
|
||
<div id="line4"></div>
|
||
</div>
|
||
<div class="home--nav__tab--item">
|
||
<a href="./about.html">关于我们</a>
|
||
<div id="line5"></div>
|
||
</div>
|
||
<!-- <div class="home--nav__tab--item">
|
||
<a href="./login.html">登录</a>
|
||
<div id="line5"></div>
|
||
</div> -->
|
||
</div>
|
||
<div class="home--nav__phone">
|
||
<!-- <div class="home--nav__phone--text" onclick="toLogin()">登录</div> -->
|
||
|
||
<a href="login.html" class="home--nav__phone--text" id="login">登录</a>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
</body>
|
||
<script>
|
||
|
||
|
||
if (localStorage.getItem('userName')){
|
||
|
||
var name = localStorage.getItem('userName')
|
||
// 获取元素引用
|
||
const link = document.getElementById('login');
|
||
|
||
// 方法1: 使用innerHTML
|
||
link.innerHTML = name;
|
||
|
||
// // 方法2: 使用innerText (更安全,防止XSS攻击)
|
||
// link.innerText = name;
|
||
//
|
||
// // 方法3: 使用textContent
|
||
// link.textContent = name;
|
||
|
||
link.href = "business.html";
|
||
}
|
||
|
||
</script>
|
||
<script>
|
||
|
||
|
||
|
||
$(document).ready(function() {
|
||
$(".home--nav__tab--item >a").each(function() {
|
||
if ($($(this))[0].href == String(window.location))
|
||
$(this).parent().addClass('active');
|
||
console.log($(this).parent())
|
||
});
|
||
});
|
||
</script>
|
||
</html>
|