<html> 

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>EditSelect</title>
<script>
function isIE(){
a=navigator.appVersion.split(";")
b=a[].split(" ")
return parseFloat(b[])
} if (isIE()<5.5)
{
scHTML='<div id="selectcontent" class="selectdiv" style="visibility:hidden;"><!--<iframe id=selframe frameborder=0 height=100%></iframe>--><div id="selecthtml" class="selectcontent">selectÁÐ表</div></div>'
}
else
{
scHTML='<div id="selectcontent" class="selectdiv" style="visibility:hidden;"><iframe id=selframe frameborder=0 height=100%></iframe><div id="selecthtml" class="selectcontent">selectÁÐ表</div></div>'
} document.write(scHTML)
vDiv=selectcontent
vDivHtml=selecthtml function editselect(name,size,defaulttext,width,height,readonly){
var combo=this;
this.options=new Array();
this.oj=new Array();
this.name=name;
this.divname=name+'_div';
this.buttonname=name+'_button';
this.tablename=name+'_table';
this.htmltable=name+'_html'
if (!height) this.height=; else this.height=height
if (width) this.width=width
if (!size) size=
if (!defaulttext) defaulttext=""
if (!readonly || readonly==) {readonly="" }else {if (readonly==) readonly="readonly style=cursor:default";this.readonly=} esHTML='<div id='+this.divname+'>'
+'<table id='+this.tablename+' cellpadding=0 cellspacing=0 class=select><tr><td bgcolor=#FFFFFF>'
+'<input type=text class=selecttext size="'+size+'" name='+name+' value="'+defaulttext+'" '+readonly+'><td><button class=selectbutton id='+this.buttonname+'>6</td></tr></table>'
+'</div>'
document.write(esHTML)
this.sbutton=eval("document.all."+this.buttonname) if (this.readonly==) eval("document.all."+this.name).onclick=function(){combo.show()} this.sbutton.onclick=function(){combo.show()}
this.show=function(){
pDiv=eval(combo.divname)
pTable=eval(combo.tablename)
var vHTML='<table id=htmltable cellspacing="0" cellpadding="2" bgcolor="#ffffff" class="selecttable" width=100%>'
for (i=;i<combo.options.length;i++)
{
vHTML+='<tr onmouseover="mo(this)" onmouseout="mu(this)" onclick="document.all.'+combo.name+'.value=this.innerText;selectcontent.style.visibility=\'hidden\';'+combo.oj[i]+'"><td nowrap>'+combo.options[i]
}
vHTML+="</table>"
vDivHtml.innerHTML=vHTML vtop=pDiv.offsetTop+pDiv.offsetHeight
vleft=pDiv.offsetLeft+ vParent = pDiv.offsetParent;
while (vParent.tagName.toUpperCase() != "BODY")
{
vleft += vParent.offsetLeft;
vtop += vParent.offsetTop;
vParent = vParent.offsetParent;
} var redge=document.body.clientWidth-vleft
var bedge=document.body.clientHeight-vtop if (!combo.width) {vDiv.style.width=pTable.offsetWidth} else {vDiv.style.width=combo.width} if (combo.height==)
{
vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+
vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+
}
else
{
if (htmltable.offsetHeight>combo.height)
{
vDiv.style.pixelHeight=combo.height
vDivHtml.style.pixelHeight=combo.height }
else
{ vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+
vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+
} } vDivHtml.scrollTop= if (redge<vDiv.offsetWidth)
vDiv.style.left=vleft--(vDiv.offsetWidth-redge)
else
vDiv.style.left=vleft- if (bedge<vDiv.offsetHeight)
//vDiv.style.top=vtop-vDiv.offsetHeight-pDiv.offsetHeight
vDiv.style.top=vtop-vDiv.offsetHeight+bedge
else
vDiv.style.top=vtop vDivHtml.style.width=parseInt(vDiv.style.width)
vDiv.style.visibility="visible"
} this.add=function(text,js){
combo.options[combo.options.length]=text
combo.oj[combo.oj.length]=js } this.clearall=function(){
combo.options=new Array()
} this.about=function(){ }
} function mo(obj){
obj.style.backgroundColor="#000099"
obj.style.color="#ffffff"
} function mu(obj){
obj.style.backgroundColor=""
obj.style.color="#000000"
} document.onmousedown=function(){
if (vDiv.style.visibility=="visible"){
mx=event.x + document.body.scrollLeft
my=event.y + document.body.scrollTop; x1=vDiv.offsetLeft
y1=vDiv.offsetTop x2=vDiv.offsetLeft+vDiv.offsetWidth
y2=vDiv.offsetTop+vDiv.offsetHeight if (mx<x1 || my<y1 || x2<mx || y2<my)
{
vDiv.style.visibility='hidden'
}
}
}</script> <style>
.selecttext{
border:0px
height: ;
font-family:arial;
font-size:12px;
}
.selectbutton{
font-family:webdings;
font-size:10px;
height: ;
width: ;
border:1px solid #83A5EB;
line-height:0px;
padding-bottom:3px;
background-color:#D1E0FD
}
.selecttable{
font-family:arial;
font-size:12px;
cursor:default;
}
.selectcontent
{
position: absolute;
top:;
left:;
overflow:auto;
border:1px solid #
} .selectdiv
{
position: absolute;
width:;
overflow:hidden;
}
.select{
border-collapse: collapse;
border:1px solid #7F9DB9
}
</style>
</head> <body bgcolor="#83A5EB"> <table border="" width="100%">
<tr>
<td width="" align="center"><font size="">可编辑的Select</font></td>
<td><script>
var sel1=new editselect("select1","","可编辑的Select","");
sel1.add("这是一个可以编辑的Select")
sel1.add("支持CSS")
sel1.add("可以通过CSS,修改外形")
sel1.add("突破原来的Select诸多限制")
</script></td>
</tr>
<tr>
<td width="" align="center"><font size="">长度可以随意修改
可以设置为只读</font></td>
<td>
<script>
var sel2=new editselect("select2","","长度可以随意修改",,,);
sel2.add("这是一个可以编辑的Select")
sel2.add("支持CSS")
sel2.add("可以通过CSS,修改外形") sel2.add("作者:舜子制作")
sel2.add("MSN:puterjam@msn.com")
</script>
</td>
</tr>
<tr>
<td width="" align="center"><font size="">可以遮盖系统Select</font></td>
<td>
<script>
var sel3=new editselect("select3","","可以遮盖系统Select","",);
sel3.add("这是一个可以编辑的Select")
sel3.add("支持CSS")
sel3.add("可以通过CSS,修改外形")
sel3.add("突破原来的Select诸多限制")
</script>
</td>
</tr>
<tr>
<td width="" align="right"> </td>
<td><select><option>系统的Select</option></select> </td>
</tr>
</table>
</body> </html>

http://www.jb51.net/article/914.htm

可编辑select的更多相关文章

  1. 可编辑的select框的实现(实用版)

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML>  <HEA ...

  2. jquery实现可编辑的下拉框( input + select )

    HTML: <input id="inputModel" /> <select name="EngineModel" size="1 ...

  3. select()

    select(),确定一个或多个套接口的状态,本函数用于确定一个或多个套接口的状态,对每一个套接口,调用者可查询它的可读性.可写性及错误状态信息,用fd_set结构来表示一组等待检查的套接口,在调用返 ...

  4. js,JQuery实现,带筛选,搜索的select

    代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title& ...

  5. jqgrid 实现行编辑,表单编辑的列联动

    这个问题的场景相信大家都遇到过,比方有A,B,C三列,B,C列均为下拉框.可是C列的值是由B列的值来决定的.即C列中的值是动态变化的,变化的根据就是B列中你选择的值. 本文给出的是一个有用,简易快捷的 ...

  6. 你想的到想不到的 javascript 应用小技巧方法

    javascript 在前端应用体验小技巧继续积累. 事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElemen ...

  7. javascript小技巧

    事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElement.setCapture();  event.srcE ...

  8. JS详解

    事件源对象:event.srcElement.tagName  event.srcElement.type 捕获/释放:event.srcElement.setCapture();  event.sr ...

  9. JS技术大全

    事件源对象:event.srcElement.tagName  event.srcElement.type 捕获/释放:event.srcElement.setCapture();  event.sr ...

随机推荐

  1. wordpress /wp-content/plugins/wp-symposium/server/php/UploadHandler.php File Arbitrary Upload Vul

    catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 Relevant Link:2. 漏洞触发条件3. 漏洞影响范围4. 漏 ...

  2. php常用函数(持续更新)

    每一种编程语言在用的过程中都会发现有时候要一种特定需求的功能函数,结果没有内置这样的函数,这个时候就需要自己根据已有函数编写尽可能简单的函数,下面是我在做php相关工作时积累下的函数,会持续更新,您要 ...

  3. [资料搜集狂]D3.js数据可视化开发库

    偶然看到一个强大的D3.js,存档之. D3.js 是近年来十分流行的一个数据可视化开发库. 采用BSD协议 源码:https://github.com/mbostock/d3 官网:http://d ...

  4. jQuery知识点总结(第三天)

    今天来总结剩余的选择器. 非常感谢评论区提问题的朋友们,有的错误是我笔误,有的问题则是知识点没有辨析解释清楚.只要有疑问,我们大家一同探究学习. 表单对象过滤选择器: ○ 选取所有可用的元素     ...

  5. 【项目】'NSRangeException', reason: '*** -[__NSArrayM removeObjectAtIndex:]: index 2 beyond bounds [0 .. 1]'

    问题代码: [self.assetsArray objectAtIndex:indexPath.row] 问题解决思路:这里

  6. Change MYSQL data directory

    For example, change mysql data directory from /var/lib/mysql to /var/data/mysql Step1: Copy the /var ...

  7. omnet++5.0安装使用

    1.下载Windows安装包,5.0的omnetpp-5.0-src-windows.zip 2.解压到d盘 3.D:\omnetpp-5.0\doc找到这个目录,下面有个InstallGuide.p ...

  8. B2B电子商务网站技术框架

    一 设计原则 电子商务平台总体结构的设计应从体系.功能.信息.过程等各个方面保证整个电子商务平台总体目标的实现,以提高市场竞争能力.总体结构的设计应考虑以下设计原则: 快速响应原则:商机稍纵即逝,网站 ...

  9. easyUI-combotree的本地数据导入

    一.页面内容: <div style="margin:10px 0"> <a href="javascript:void(0)" class= ...

  10. JavaScript----遇到的问题

    <script type="text/javascript" src="a.js"> alert('dd'); </script> 存在 ...