用eval()函数: Sub b1_onclick()
dim i
dim oBatDate
for i=1 to 10
oBatDate=eval("document.setbatdateform.batdate"&i).
if oBatDate.value="" or not isdate(oBatDate.value) then
msgbox "Battery时间格式不正确!",16,"提示"
oBatDate.select()
oBatDate.focus()
exit sub
end if
next
document.setbatdateform.submit
end sub
dim i
dim oBatDate
for i=1 to 10
oBatDate=eval("document.setbatdateform.batdate"&i).
if oBatDate.value="" or not isdate(oBatDate.value) then
msgbox "Battery时间格式不正确!",16,"提示"
oBatDate.select()
oBatDate.focus()
exit sub
end if
next
document.setbatdateform.submit
end sub
oBatDate=eval("document.setbatdateform.batdate"&i)
就可以了