<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script src="jquery-1.10.1.min.js"></script>
<script>
//看到:has(selector)
$(function(){
//$("input[id*='man'][name$='man']").each(function(){
// alert(this.outerHTML);
//});
//$("button:only-of-type").text("Alone").css("border", "2px blue solid");
var $divstyle=$("#companydiv").attr("style");
$("#company").bind("focus", function(){
var $inptop=$(this).offset().top;
var $inpleft=$(this).offset().left;
var $inpHei=$(this).css("height").replace("px","");
var $divcompany=$("#companydiv");
$divcompany.offset({left:$inpleft-2,top:($inptop*1+$inpHei*1)});
document.getElementById("companydiv").style.display="block";
});
$("#cfm").click(function(){
$("#companydiv").attr("style",$divstyle);
document.getElementById("companydiv").style.display="none";
var checkNum=0;
$("#companydiv").find("input[type='checkbox']").each(function(){
if($(this).is(":checked")){
var htm=$(this).next().html();
if(htm=="全 选"){
$("#company").val("全部企业");
}else{
$("#company").val(htm);
}
return false;
}else{
checkNum++;
}
});
var allCheck=$("#companydiv > input").size();
if(checkNum==allCheck){
$("#company").val("");
}
});
$("#ccl").click(function(){
$("#companydiv").attr("style",$divstyle);
document.getElementById("companydiv").style.display="none";
});
$("input[id='all']").click(function(){
if($(this).is(":checked")){
$(this).siblings().attr("checked",true);
$("#company").val("全部企业");
}else{
$(this).siblings().attr("checked",false);
$("#company").val("");
}
});
$("#companydiv > input[type='checkbox']").attr("checked",true);
});
</script>
</HEAD>
<BODY>
<input type="text" value="全部企业" id="company" style="text-align:center;width:100px;height:22px;font-size:14px;border:1px solid #74a5c5;" readonly/>
<div id="companydiv" style="height:150px;width:100px;border:1px solid #74a5c5;font-size:14px;overflow-y: auto;display:none;position:absolute;z-index:9999;">
<a href="#" id="cfm"><span style="padding-left:5px;">确定</span></a><a href="#" id="ccl"><span style="padding-left:20px;">取消</span></a>
<input type="checkbox" id="all" value="all"/><span>全 选</span>
<input type="checkbox" id="1" value="1"/><span>企业1</span>
<input type="checkbox" id="2" value="2"/><span>企业2</span>
<input type="checkbox" id="3" value="3"/><span>企业3</span>
<input type="checkbox" id="4" value="4"/><span>企业4</span>
<input type="checkbox" id="5" value="5"/><span>企业5</span>
<input type="checkbox" id="6" value="6"/><span>企业6</span>
<input type="checkbox" id="7" value="7"/><span>企业7</span>
<input type="checkbox" id="8" value="8"/><span>企业8</span>
<input type="checkbox" id="9" value="9"/><span>企业9</span>
<input type="checkbox" id="10" value="10"/><span>企业10</span>
<input type="checkbox" id="11" value="11"/><span>企业11</span>
<input type="checkbox" id="12" value="12"/><span>企业12</span>
<input type="checkbox" id="13" value="13"/><span>企业13</span>
<input type="checkbox" id="14" value="14"/><span>企业14</span>
</div>
</BODY>
</HTML>