html table vtop,在html中實現可輸入的下拉列表

#6

scHTML='

selectÁÐ鹵鉚
'

document.write(scHTML)

vDiv=selectcontent

vDivHtml=selecthtml

function editselect(name,size,defaulttext,width,height,readonly){

var combo=this;

this.options=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=0; else this.height=height

if (width) this.width=width

if (!size) size=8

if (!defaulttext) defaulttext=""

if (!readonly || readonly==0) {readonly="" }else {if (readonly==1) readonly="readonly style=cursor:default";this.readonly=1}

esHTML='

'

+'

'

+'

6
'

+'

'

document.write(esHTML)

this.sbutton=eval("document.all."+this.buttonname)

if (this.readonly==1) eval(this.name).οnclick=function(){combo.show()}

this.sbutton.οnclick=function(){combo.show()}

this.show=function(){

pDiv=eval(combo.divname)

pTable=eval(combo.tablename)

var vHTML='

for (i=0;i

{

vHTML+='

'+combo.options[i]

}

vHTML+="

"

vDivHtml.innerHTML=vHTML

vtop=pDiv.offsetTop+pDiv.offsetHeight

vleft=pDiv.offsetLeft+1

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==0)

{

vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+2

vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+2

}

else

{

if (htmltable.offsetHeight>combo.height)

{

vDiv.style.pixelHeight=combo.height

vDivHtml.style.pixelHeight=combo.height

}

else

{

vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+2

vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+2

}

}

vDivHtml.scrollTop=0

if (redge

vDiv.style.left=vleft-1-(vDiv.offsetWidth-redge)

else

vDiv.style.left=vleft-1

if (bedge

//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){

combo.options[combo.options.length]=text

}

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.οnmοusedοwn=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

{

vDiv.style.visibility='hidden'

}

}

}

var sel1=new editselect("src","25","","");

sel1.add("1111111111");

sel1.add("22222222222");

sel1.add("33333333333");

sel1.add("lixin--2324");

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值