Click to See Complete Forum and Search --> : Check for Control Existence
JazzBass
Jan 17th, 2001, 08:59 AM
Hi,
I was wondering what sort of syntax using VBscript would I have to use to check to see if a listbox exists on an html form?
I'm dynamically creating the html page and not all the listboxes may be created.
Thanks in advance.
JazzBass
Clunietp
Jan 17th, 2001, 09:46 AM
do you want this done on the client or server? If on the client, do you want VBScript or Javascript?
JazzBass
Jan 17th, 2001, 09:52 AM
Thank you,
Would like to do it on the client side, using VBScript.
JazzBass
Clunietp
Jan 17th, 2001, 09:57 AM
<html>
<head>
<script language="VBScript">
sub CheckIt()
if isobject(cboURL) then
msgbox("It's here!")
else
msgbox("It's not here!")
end if
end sub
</script>
</head>
<body onclick="CheckIt()">
<select id="cboURL">
<option value="http://www.microsoft.com">Microsoft.com
<option value="http://www.vbforums.com">VB Forums
<option value="http://www.netscape.com">Netscape.com
</select>
</body>
</html>
The code is fired on the onclick event of the document, you can move that to wherever. My point here is to show the use of IsObject to determine whether the object exists or not
Tom
JazzBass
Jan 17th, 2001, 10:10 AM
Tom,
Thank you very much. That's looks like it will work great! One last question. Can I use the object's name instead of id to get this to work?
JazzBass
Clunietp
Jan 17th, 2001, 10:14 AM
Yup, I just tried it out and it works fine
Enjoy!
JazzBass
Jan 17th, 2001, 10:18 AM
Mucho thanks. :D
I really appreciate it.
JazzBass
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.