300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 基于jquery实现的可以编辑选择的下拉框的代码【jquery】

基于jquery实现的可以编辑选择的下拉框的代码【jquery】

时间:2019-07-06 16:31:04

相关推荐

基于jquery实现的可以编辑选择的下拉框的代码【jquery】

web前端|js教程

可以编辑,下拉框

web前端-js教程

效果图:

代码如下:

学籍管理系统源码,vscode 编译命令,如何删除ubuntu系统图解,tomcat改为ip,php-sqlite3,bt效果 插件,三个前端框架,爬虫都合法吗,php 取类型,廊坊搜索引擎优化seo,家居定制网站源码,个人简洁网页设计代码,好看的的模板,jsp页面发布,asp代码文档管理系统,蓝海豚php开源团购导航程序lzw

可以编辑的下来框实现方法--woody.wu

.cssINPUT

{

height: 19PX;

padding: 3PX;

padding-left: 3px;

padding-right: 0px;

margin: 0PX;

border: 1PX SOLID #C0C0C0;

font-family: 宋体,arial;

font-size: 9pt;

}

.select_div_list

{

position: absolute;

border: 1px solid black;

background-color: White;

overflow: hidden;

overflow-y: auto;

}

.select_div_list_ul

{

margin: 0px;

padding: 0px;

list-style-type: none;

}

.select_div_list_ul li

{

cursor: pointer;

padding-left: 3px;

font-family: 宋体,arial;

font-size: 9pt; *padding:0px;*height:20px;_height:14px;_margin:0px;_height:14px;*margin:0px;line-height:14px;}

.selectSPAN

{

background-color: Yellow;

}

var inputID = "input1";

var selectID = "select1";

var widt = 0;

var inputWi = 0;

var he = 0;

$(function() {

inputID = "input1";

selectID = "select1";

widt = 200;

inputWi = widt - 20;

he = $("#user").height() - 41;

var offset = $("input[id=input1]").offset();

$("#" + selectID).change(function() {

var newvar = $("#" + selectID).find("option:selected").text();

$("#" + inputID).val(newvar);

}).click(function() {

$("#select_div_on_key" + selectID).remove();

}).css({ "display": "block", "width": widt + "px", "z-index": 1, "clip": "rect(0px " + widt + "px 51px 151px)" });

$("#" + inputID).keyup(function() {

ShowSelectCombo();

}).click(function() {

ShowSelectCombo();

}).css({ "z-index": 2, "width": inputWi + "px" }); ;

});

function ShowSelectCombo() {

var pob = $("#" + inputID);

var v = pob.val();

var off = pob.offset();

var wi = pob.width() + 16;

var tp = off.top + pob.height() - 100 + 7;

var lef = off.left - 200 + 2;

var html = "

";

$("#" + selectID).find("option").each(function() {

var tk = $(this);

html += "" + tk.html().replace(v, "" + v + "") + "";

});

html += "

";

var ulDIV = $("#select_div_on_key" + selectID);

ulDIV.remove();

$("#user").append(html);

var ulDIV = $("#select_div_on_key" + selectID);

var hei = ulDIV.find("ul").height();

var newHeight = hei > he ? he : hei;

ulDIV.css({ height: newHeight + "px" });

ulDIV.find("li").hover(function() {

$(this).css({ "background-color": "#316ac5" });

}, function() {

$(this).css({ "background-color": "white" });

});

ulDIV.find("li").click(function() {

var ki = $(this);

var va = ki.attr("val");

var htm = ki.attr("ht");

htm = decodeURIComponent(htm);

$("#" + inputID).val(htm);

$("#" + selectID).val(va);

ulDIV.remove();

});

}

最新微信公众号源码,ubuntu网络配置查询,强化学习爬虫,转跳php,seo文章整合lzw

<div_height: 20px;

*height: 13px; display: block; float: left; position: absolute; border-right: 0px;’ />

車身和底盤修整設備

真空吸盤

氧/乙炔焊割工具

冷鉚机

大市場撒旦

大擦

第三十

大市場

車身外形修复机(介子机)

沙皮狗

整形机

舉升机

修車躺板

空調制冷劑充注机

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。