A imitation Taobao TAB switch search box. Switch to whichever content you want to search. Interested friends can check out the code below.
<div><div id="searchBox"><ul id="tabBar"><li tips="please enter product name">Product</li><li><span>|</span></li><li tips="please enter store name">Shop</li></ul><div id="tabBox"><form onsubmit="" action="" method="get" name="searchForm" id="searchForm"><input id="keyword" name="keyword" lang="zh-CN" type="text" value="please enter product name"><input value="Search" onfocus="this.blur()" type="submit"></form></div><div><a href="#"><span>Men's Clothing</a></a><a href="#">Doomwoman's Shoes</a><a href="#">Shenggao Men's Shoes</a><a href="#"><span>Women's Clothing</a></a> <a href="#">Sunscreen</a> <a href="#">Hair Removal Cream</a></div></div>
.search{ position: absolute; top:14px; left: 34%; width:477px; _width:477px; height: 81px;}.keyword a{ font-size: 12px; line-height: 18px; color:#999; padding:0 4px;}.keyword a span{ color:#fb5004;}.tab-bar li.current{ color: #1d7ad9; font-weight: bold; background: url(../images/trian_up.png) no-repeat center bottom; padding-bottom: 9px;}.tab-bar li{ width:38px; text-align: center; color: #444; float: left; cursor: pointer;}.tab-bar li.tab-line{ width: 2px; color: #c9c9c9; margin:0 2px;}.tab-box{ border:2px solid #1d7ad9;}.text{ color: #a9a9a9; width:376px; height: 31px; border:none; text-indent: 10px; float:left; outline: none; border:0;}.button{ width: 97px; height: 32px; text-align: center; color: #ffff; font-size:18px; background: #1d7ad9; border:none; float: left;} <script type="text/javascript">$(function(){// Search toggle $('#tabBar').on('click', 'li', function(){var tips = $(this).attr('tips');if(tips){$(this).addClass('current').siblings().removeClass('current');$('#keyword').val(tips);} });</script>