手机
当前位置:查字典教程网 >编程开发 >ASP教程 >ASP常用函数:CheckBoxScript()
ASP常用函数:CheckBoxScript()
摘要:程序代码例子:程序代码1020304050

程序代码

<%
'功能:用来在指定CheckBox的哪几个值上打勾
'来源:/asp.asp

Function CheckBoxScript(ByVal FormElement , ByVal ElementValue)
CheckBoxScript = "<scr" & "ipt language=""javascript"" type=""text/Javascript"">" & vbCrLf & "String.PRototype."
CheckBoxScript = CheckBoxScript & "ReallyDo=function(){return this.replace(/(^s*)|(s*$)/g,"""");}" & vbCrLf
CheckBoxScript = CheckBoxScript & "var Jorkin = """ & ElementValue & """.split("","");" & vbCrLf
CheckBoxScript = CheckBoxScript & "for (i = 0; i < " & FormElement & ".length; i++){" & vbCrLf
CheckBoxScript = CheckBoxScript & " for (j = 0; j < Jorkin.length; j++){" & vbCrLf
CheckBoxScript = CheckBoxScript & " if (Jorkin[j].ReallyDo() == " & FormElement & "[i].value.ReallyDo()){" & vbCrLf
CheckBoxScript = CheckBoxScript & " " & FormElement & "[i].checked = true } } }</scr" & "ipt>" & vbCrLf
End Function
%>

例子:

程序代码
<form name="Form1">
<input name="ReallyDo" type="checkbox" id="ReallyDo1" value="10" />10
<input name="ReallyDo" type="checkbox" id="ReallyDo2" value="20" />20
<input name="ReallyDo" type="checkbox" id="ReallyDo3" value="30" />30
<input name="ReallyDo" type="checkbox" id="ReallyDo4" value="40" />40
<input name="ReallyDo" type="checkbox" id="ReallyDo5" value="50" />50
</form>
<%=CheckBoxScript("Form1.ReallyDo","10,30, 50")%>

【ASP常用函数:CheckBoxScript()】相关文章:

一个实用asp分页函数

ASP常用函数:Trace()

使用ASP在IIS创建WEB站点的函数

PerlScript编写ASP(转载)

ASP常用函数:Delay()

ASP中一个用VBScript写的随机数类

ASP 写的自动生成SELECT 表单的函数

ASP常用函数:getpy()

ASP常用函数:LastDay()

提供几个关于采集的函数(ASP)

精品推荐
分类导航