足球游戏_中国足彩网¥体育资讯$

select控件的宽度的设置方法
来源:易贤网 阅读:514 次 日期:2014-09-12 14:27:03
温馨提示:易贤网小编为您整理了“select控件的宽度的设置方法”,方便广大网友查阅!

自动调整为最大长度:

<select style=width:expression((this.offsetwidth>100)?'auto':'100')>

<option >hellohellohellohellohellohellohellohellohellohello</option>

</select>

鼠标点时自动变成最大长度,离开或选中时恢复原长度

<select name=s2 style=width:50px onfocus=this.style.width='auto'onblur=this.style.width='50px' onchange=this.style.width ='50px'>

<option>1111111111111111111111111111</option>

<option>2222222222222222222</option>

</select>

鼠标滑过时自动变成最大长度,离开或选中时恢复原长度

<select name=s2 style=width:50px onmouseover=this.style.width='auto' onblur=this.style.width='50px' onchange=this.style.width='50px'>

<option>1111111111111111111111111111</option>

<option>2222222222222222222</option>

</select>

选择后在页面地其它位置显示选择地项目

<div id=dsp></div>

<select name=select size=1 onchange=dsp.innertext=this.options[this.selectedindex].text>

<option value=1>test</option>

<option value=2 selected>test2</option>

</select>

鼠标滑过时显示当前选择地项目地值

<div id=div1 style=overflow:auto;height:expression(5*15);width:expression(document.all.s1.offsetwidth+18);>

<select name=s1 size=1 style=width:120 onmousemove=showtitle(this);onmouseout=hidetitle(this);>

<option>aaaaaaaaaaaaaaaaaaaaaa1 </option>

<option >bbbbbbbbbbbbbbbbbbbbbbbbb1 </option>

<option>cccccccccccccccccccccccc1 </option>

<option>ddddddddddddddddddddddd1 </option>

<option>eeeeeeeeeeeeeeeeeeeeeee1 </option>

<option>fffffffffffffffffffffffffff1 </option>

</select>

</div>

<script>

// 定义popup

var op=window.createpopup();

op.document.body.style.background=beige;

//popup 是否已显示

var opshow=0;

function showtitle(obj){

var h=event.offsety;

var fontsize=(obj.style.fontsize==?(obj.currentstyle.fontsize==?9:obj.currentstyle.fontsize):obj.style.fontsize);

fontsize=parseint(fontsize)*1.6;

var l=parseint(h/fontsize);

op.document.body.innertext=obj.options[l].text;

len=obj.options[l].text.length*8;

op.show(event.offsetx+20,event.offsety+fontsize+5,len,fontsize,document.body);

opshow=1;

}

function hidetitle(obj){

if(opshow==1)op.hide();

}

</script>

中国足彩网信息请查看IT技术专栏

中国足彩网信息请查看网页制作
易贤网手机网站地址:select控件的宽度的设置方法
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标