日期:2014-05-16 浏览次数:20380 次
<form>
<div class="select" id="search_field">
<a href="javascript:void(0)" class="cur" id="search_key">图书<b></b></a>
<ul id="search_cate" style="display:none;">
<li>图书</li>
<li>视频</li>
<li style="border-bottom:0;">资料</li>
</ul>
</div>
<div class="clear"></div>
<input type="text" id="search-input" value="热门搜索提示" class="ac-input" autocomplete="off" />
<input type="image" class="ac-image" src="images/btn-search.gif" />
</form>
div.search form { display:block; float:left; width:475px; margin:29px 0; padding:0; font-size:12px; position:relative; z-index:1; zoom:1; }
div.search form .select { position:absolute; width:57px; height:32px; line-height:32px; left:0px; z-index:5;}
div.search form .select a.cur { display:block; height:100%; width:48px; padding-left:8px; border-right:1px solid #CCC; position:relative; }
div.search form .select a.cur b { position:absolute; width:0; height:0; border-width: 4px 4px; border-style: solid; border-color: #666 whiteSmoke whiteSmoke; font-size: 0; line-height: 0; top: 14px; right: 10px;}
div.search form .select ul { width:55px; border: 1px solid #CCC; margin-top:-1px; color:black; background-color: white; }
div.search form .select ul li { border-bottom: 1px solid #ccc; padding-left:8px;}
var sf = document.getElementById("search_field"),
sc = document.getElementById("search_cate");
sf.onmouseover = function(){
sc.style.display = "";
}
sf.onmouseout = function(e){
var e = e || window.event;
var p = e.relatedTarget || e.toElement || e.fromElement;
while(p){
if(p!==sf) p=p.parentNode;
else {
return;
}
}
sc.style.display = "none";
}
<form>
<div class="select" id="search_field">
<a href="javascript:void(0)" class="cur" id="search_key">图书<b></b></a>
<ul id="search_cate" style="display:none;">
<li>图书</li>
<li>视频</li>
<li style="border-bottom:0;">资料</li>
</ul>
&nb