<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>导航</title>
<style>
html, body{height:100%; width:100%; margin:0; padding:0;}
body {line-height:1.5; font-family: 微软雅黑; background:-webkit-gradient(linear, left top, left bottom, from(#eee), to(#fff));}
.nav {border:solid 1px #C0C0C0; margin-bottom:20px; border-radius: 5px; background-color: #fff;}
.nav:hover {box-shadow: 0 5px 30px #999;}
.nav h3 {margin:0; background-color:#ABCDEF; padding:5px 10px; font-weight:normal; font-size:16px;}
.nav h3 i {font-style:normal; padding-left:10px; color:red;}
.clear {clear:both; height:15px;}
.nav a {float:left; width:150px; margin-top:15px; margin-left:10px; text-align:center; text-decoration: none;}
.nav a:hover {text-decoration: none; color:red;}
.nav a i {font-style:normal; color:#999; font-size:9px; position: relative; top:-10px; left:0px; padding:1px 3px;}
</style>
<style>
.search_form{
width:420px;
height:40px;
}
/*左边输入框设置样式*/
.input_text{
width:1000px;
height: 40px;
border:1px solid green;
/*清除掉默认的padding*/
padding:0px;
/*提示字首行缩进*/
text-indent: 10px;
/*去掉蓝色高亮框*/
outline: none;
/*用浮动解决内联元素错位及小间距的问题*/
float:left;
}
.input_sub{
width:100px;
height: 45px;
background:#4285F4;
/*去掉submit按钮默认边框*/
border:0px;
/*改成右浮动也是可以的*/
/*float:right;*/
color:black;/*搜索的字体颜色为白色*/
cursor:pointer;/*鼠标变为小手*/
}
</style>
<body>
<center>
<form action="https://www.baidu.com/s?" method="get">
<form class="search_form">
<label for="keyword"><img src="Logo.ico"></label><br>
<input type="text" name="wd" class="search_form" value="" placeholder="百度一下,你就知道" >
<input type="submit" value="百度一下" class="input_sub">
</form>
</form>
</center>
</body>
<br>
</br>
<script>
$(function(){
$('.nav a').each(function(){
var href = $(this).attr('href');
var count = window.localStorage.getItem(href);
count = count || 0;
$(this).append('<i>' + count + '</i>');
$(this).attr('target', '_blank');
$(this).click(function(){
var count = parseInt($(this).find('i').html()) + 1;
$(this).find('i').html(count);
window.localStorage.setItem(href, count);
console.log(count);
});
$(this).hover(function(){
$(this).parents('.nav').find('h3 i').html($(this).attr('href'));
}, function(){
$(this).parents('.nav').find('h3 i').html('');
});
});
});
}
</script>
</head>
<body link="#292421" vlink="#292421">
<div style="max-width:1000px; margin:10px auto;">
<div class="nav">
<h3>类别一 <i></i></h3>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<div class="clear"></div>
</div>
<div class="nav">
<h3>类别二 <i></i></h3>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<div class="clear"></div>
</div>
<div class="nav">
<h3>类别三<i></i></h3>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<a href="http://www.网址.com">网址</a>
<div class="clear"></div>
</div>
</div>
</body>
</html>
最后修改:2022 年 02 月 22 日
© 允许规范转载