Results 1 to 7 of 7

Thread: Check for Control Existence

  1. #1

    Thread Starter
    Hyperactive Member JazzBass's Avatar
    Join Date
    Jun 1999
    Posts
    393

    Smile

    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
    JazzBass
    In the .NET era
    Trying to remember VB6
    Progress:
    XP Professional @ Home
    and @ the Office

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    do you want this done on the client or server? If on the client, do you want VBScript or Javascript?

  3. #3

    Thread Starter
    Hyperactive Member JazzBass's Avatar
    Join Date
    Jun 1999
    Posts
    393

    Talking Thanks,

    Thank you,
    Would like to do it on the client side, using VBScript.
    JazzBass
    JazzBass
    In the .NET era
    Trying to remember VB6
    Progress:
    XP Professional @ Home
    and @ the Office

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    Code:
    <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

  5. #5

    Thread Starter
    Hyperactive Member JazzBass's Avatar
    Join Date
    Jun 1999
    Posts
    393

    Smile Thanks, another question

    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
    JazzBass
    In the .NET era
    Trying to remember VB6
    Progress:
    XP Professional @ Home
    and @ the Office

  6. #6
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    Yup, I just tried it out and it works fine

    Enjoy!

  7. #7

    Thread Starter
    Hyperactive Member JazzBass's Avatar
    Join Date
    Jun 1999
    Posts
    393

    Talking Thanks!

    Mucho thanks.

    I really appreciate it.

    JazzBass

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width