针对select写了一个通用的option输出函数
来源:互联网 发布:300451创业软件 编辑:程序博客网 时间:2024/04/28 07:21
'author:chjpeng
'email:chjpeng@163.com
function writeSlt(arrstr,arrstrValue,selectedstr)
'arrstr 要显示在option里面的值,arrstrValue option的实际值,selectedstr要选中的默认值
'将一个字串分割为数组,输出select的option,并选中selectedstr arrstr&arrstrValue长度要一致
arr=split(arrstr,",")
arrValue=split(arrstrValue,",")
j=0
do while j<=ubound(arr)
if trim(arrValue(j))=trim(selectedstr) then
response.write "<option value='" & arrValue(j) & "' selected>" & arr(j) & "</option>"
else
response.write "<option value='" & arrValue(j) & "'>" & arr(j) & "</option>"
end if
j=j+1
loop
end function
可以从数据库中读出数据,形成逗开分隔的字符串,来动态生成select的<option>
function getArrString(table,fld,cond,sortfld)
'获取一个指定表中指定字段指字条件的数据,返回一个以逗号分隔的字符串
set rs=server.createobject("adodb.recordset")
sql="select " & fld & " from " & table
if len(cond)>0 then
sql=sql & " where " & cond
end if
if len(sortfld)>0 then
sql=sql & " order by " & sortfld
end if
rs.Open sql,conn,1,1
if not (rs.bof or rs.EOF) then
do while not rs.EOF
getArrString=getArrString & trim(rs(fld)) & ","
rs.MoveNext
loop
end if
getArrString=left(getArrString,len(getArrString)-1)
rs.Close
set rs=nothing
end function
- 针对select写了一个通用的option输出函数
- 写了一个分页通用的
- 写一个通用的事件监听函数
- 写一个通用的冒泡排序函数
- 写一个通用的事件侦听器函数?
- 写一个通用的事件侦听器函数
- 写了一个通用的查询Sql的函数 ----VC新手
- 针对网上很多抱怨的言论,写了一个EF中update对象时,通用的遍历赋值方法,以供参考
- 使用js函数对select中的option排序后输出
- 用Java学写了一个“打印输出杨辉三角的函数”,请批评
- angularjs select初始化时多了一个 null option
- select option如果里面不写value值,默认提交<option></option>中间的值
- PB9写的一个拆解SQL语句的通用函数
- PB9写的一个拆解SQL语句的通用函数
- PB9写的一个拆解SQL语句的通用函数
- PB9写的一个拆解SQL语句的通用函数
- 写一个高效且通用的拷贝函数
- 写了一个通用在线播放器
- VB基础版版务处理_20050803
- 跑步-第一天
- java.util.List翻译
- 在iframe中使用带iframe的日历组件
- 字符编码相关
- 针对select写了一个通用的option输出函数
- Jbilder2005的配置
- 对联js
- 一个查找source code的好地方.(http://www.koders.com/)
- 我刚化完妆~
- ASP.NET之精通弹出窗口(转载)
- Eclipse 平台入门
- 什么技术正走红?十大热点勾画网络蓝图(ZT)
- Visio 2003 ShapeStudio 形状开发入门