模仿combox(select)控件,不用为美化select烦恼了。

不用整天为美化select控件烦恼了。

1、可批量美化select控件。
2、可以有onchange句柄。
3、触发onchange的函数可带参数。
3、可以得到select的值。
4、可设置像select类似的滚动条(如大于或等于8个数目时出现滚动条)
5、可设置宽度和高度

API参考:
//首先生成一个simulateSelect的实例
//构造函数的第一个可选参数为触发onchange的函数,其它的为onchange函数的参数;
c = new simulateSelect(s1onchange, “never-online”);
//设置select的CSS,第一个参数为控件的主要CSS、第二个为选中条目时的CSS、第三个为没有选中条目时的CSS
c.style(“CtlSelect2”, “selected2”, “unselected2”);
//设置select的宽度和高度;
c.width = 320;
c.height = 20;
//初始化参数为:select控件的ID,可以用逗号分离,进行批量转换;
c.init(“s1,s2,s3”);

下一版本将可修改combox





simulate combox control – http://www.never-online.net





simulate combox control

demonstrate

normal select:

simulate select:

scroll simulate select:

onchange handler fire:



description

//-------------------------------------------------------------
//  @ Module: simulate select control, IE only.
//  @ Debug in: IE 6.0
//  @ Script by: blueDestiny, never-online
//  @ Updated: 2006-3-22
//  @ Version: 1.0 apha
//  @ Email: blueDestiny [at] 126.com
//  @ Website: http://www.never-online.net
//  @ Please Hold this item please.
//
//  API
//  @ class: simulateSelect()
//
//  @ object.style(ctlStyle[,selStyle][,unselStyle])
//    ctlStyle: main control combox css class name
//    selStyle: when mouseover or option focus css class name
//    unselStyle: options blur's css class name
//
//  @ object.width=(widthPX)
//    widthPX must be a digit number.
//
//  @ object.height=(heightPX)
//    heightPX must be a digit number.
//
//  @ object.getValue(ctlSelID)
//    ctlSelID is the unique select control ID
//
//  -------------- for the next Version ----------
//  @ object.readOnly = (blnReadOnly)
//    blnReadOnly must be a boolean type or a number type.
//  @ object.addEvent(w, h)
//    w: fire handler's event.
//    h: handler function.
//-------------------------------------------------------------





发表评论

您的电子邮箱地址不会被公开。

− 8 = 1