asp

位置:IT落伍者 >> asp >> 浏览文章

ASP常用函数:CheckBoxScript()


发布日期:2019年10月18日
 
ASP常用函数:CheckBoxScript()

程序代码

<%
功能:用来在指定CheckBox的哪几个值上打勾

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

例子:

程序代码
<form name="Form">
<input name="ReallyDo" type="checkbox" id="ReallyDo" value="" />
<input name="ReallyDo" type="checkbox" id="ReallyDo" value="" />
<input name="ReallyDo" type="checkbox" id="ReallyDo" value="" />
<input name="ReallyDo" type="checkbox" id="ReallyDo" value="" />
<input name="ReallyDo" type="checkbox" id="ReallyDo" value="" />
</form>
<%=CheckBoxScript("FormReallyDo"" ")%>

               

上一篇:asp中的一些日期时间函数

下一篇:ASP中轻松实现变量名-值变换