Rookie School:
In the past two days, I saw a friend asking about how to operate various controls in html using script, and now I will summarize it myself. Due to project reasons, many programs are written in vbscript. Interested friends can rewritten them into JavaScript. Don’t forget to share them at that time, live.
gfgetcheckboxvalue = strvalue
end function
The above is the method of handling check boxes in vbscript (usually used). These functions can be encapsulated into a common vbs file and referenced in the <head> tag area of the html can be used for common use~ For example, <head><script language=vbscript src=vbschkboxtool.vbs></script></head>
You should also pay attention to one problem. In actual applications, there may be no record in the list generated based on the query conditions, which means there is no check box control. If you still call such a control with a name, an ie will report an error at this time. There is no good solution, so I wrote a program to bypass this situation where there is no checkbox control:
function sischkboxexist()
on error resume next
err.clear
if isempty(document.frmorderlist.chkorder) then
end if
if err.number <> 0 then
else
sischkboxexist=true
end if
err.clear
end function
Do any operation on the predetermined control in the program, such as isempty. If the situation of err.number>0 is captured, it means that the control does not exist. However, due to on error resume next, there will be no error, which means that it is determined whether the control exists or not.
Before calling the above three functions, call the sischkboxexist function to see if the corresponding control exists, so there will be no mistakes.
- eom -