Files
safe/header.html
myTest383 1d353f4af3 111
2025-04-30 17:49:53 +08:00

78 lines
2.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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&#45;&#45;nav__phone&#45;&#45;text" onclick="toLogin()">登录</div> -->
<a href="login.html" class="home&#45;&#45;nav__phone&#45;&#45;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>