ASP怎样使用vbscript将提交的form表单键值组成数据对输出为数组或者json格式的字符串呢?下面给一个演示:
for str_i = 1 to Request.form.count
formkey=trim(Request.form.key(str_i))
formvalue=trim(Requesta(formkey))&""
checkissub=checkinput(formkey,formvalue)
' response.Write(formkey&"="&formvalue&"("&checkissub&")<BR>")
if checkissub="" then
if formkey<>"" And checkRegExp(formkey,"^[\w]+$") then
execute formkey & "=formvalue"
end if
else
errstr=checkissub
end if
next
for str_i=1 to Request.querystring.count
formkey=trim(Request.querystring.key(str_i))
formvalue=trim(Requesta(formkey))&""
checkissub=checkinput(formkey,formvalue)
if checkissub="" then
'response.write formkey & "="&formvalue & "<br>"
if formkey<>"" And checkRegExp(formkey,"^[\w]+$") then
execute formkey & "=formvalue"
end if
else
errstr=checkissub
end if
next