How do you check if element exists on the page?

vbscript , form elements Hollywood, United States
  • 12 years ago
    Please help. How do you check if element exists on the page? Webpage Script Errors User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1) Timestamp: Tue, 27 Jan 2009 14:06:38 UTC Message: Object variable not set Line: 205 Char: 3 Code: 0 Message: Object doesn't support this property or method Line: 545 Char: 1 Code: 0
  • 12 years ago
    My test (was stripped in the original post) - returns the error. if IsObject(document.getElementById("txtFName")) then msgbox document.getElementById("txtFName").value else msgbox "object not found" end if

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++ : Where friends have access to your private members.” - Gavin Russell Baker