古詩詞大全網 - 成語查詢 - ASP獲取壹個數組的個數

ASP獲取壹個數組的個數

首先妳的ID發送是使用什麽方式發送,如果是用字符串拼接的,如:1,2,3,4,5,6

這樣用逗號分隔的話,那麽在ASP處理頁中可以使用如下方式來處理

Dim Ids,i

ids = Split(Trim(Request.Form("IDS")),",")'獲得分隔ID數組

if Ubound(ids) > 4 then

response.write "超過最大選項"

response.end

end if

'開始檢查ID有效性

for i = 0 to Ubound(ids)

if not isnumeric(ids(i)) then

response.write "不是壹個有效的ID!"

response.end

end if

next