<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">body{font-size:12px;}.selectItemcont{padding:8px;}#selectItem{border:1px solid #f00;background:#FFF;position:absolute;top:0px;left:center;overflow:hidden;width:240px;z-index:1000;}.selectItemhidden{display:none;}</style><script type="text/javascript" class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="引入jquery库"></script><script>(function($){ $.fn.bgIframe=$.fn.bgiframe = function(s){ return this; };})(jQuery);jQuery.fn.selectCity = function(targetId) { var _seft = this; var targetId = $(targetId); this.click(function(){ var A_top = $(this).offset().top + $(this).outerHeight(true); // 1 var A_left = $(this).offset().left; targetId.bgiframe(); targetId.show().css({"position":"absolute","top":A_top+"px" ,"left":A_left+"px"}); }); targetId.find("#selectSub :checkbox").click(function(){ targetId.find(":checkbox").attr("checked",false); $(this).attr("checked",true); _seft.val( $(this).val() ); targetId.hide(); }); $(document).click(function(event){ if(event.target.id!=_seft.selector.substring(1)){ targetId.hide(); } }); targetId.click(function(e){ e.stopPropagation(); // 2 }); return this;}$(document).ready(function(){ $("#address").selectCity("#selectItem");}) </script></head><body><input type="text" name="address" id="address" ><div id="selectItem" class="selectItemhidden"> <div id="selectItemCount" class="selectItemcont"> <div id="selectSub"> <input type="checkbox" name="cr01" id="cr01" value="搜索记录1"/><label for="cr01">搜索记录1</label><br /> <input type="checkbox" name="cr02" id="cr02" value="搜索记录2"/><label for="cr02">搜索记录2</label><br /> <input type="checkbox" name="cr03" id="cr03" value="登陆账号3"/><label for="cr03">登陆账号3</label><br /> <input type="checkbox" name="cr04" id="cr04" value="登陆账号4"/><label for="cr04">登陆账号4</label><br /> 清除历史记录... </div> </div></div></body></html>
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦