checkbox用CheckBoxScript怎么用?
error: 'String.PRototype' 为空或不是对象 我想实现的是编辑页面默认勾选之前添加页面所作的勾选.
下面id的人是勾选组长和村代表,即数据库czzmm那里是1,2
下面是代码:
村政治面貌
<input name="czzmm" type="checkbox" value="1" />组长
<input name="czzmm" type="checkbox" value="2" />村代表
<input name="czzmm" type="checkbox" value="3" />村民
<%
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
%>
<%
resultStr=rs("czzmm")--------------------'response.Write(resultstr)是1,2
<%=CheckBoxScript("edituser.czzmm",resultStr)%>