Solved

"object required" in VBScript

Posted on 2004-04-07
5
2,879 Views
Last Modified: 2007-12-19
First off, I'm new to this, so my apologies if the question is stupid.   I'm writing some simple VBScript to reference various attributes of the "document" object for an HTML page.  Sometimes (not always), when I do something like document.getelementbyid("name").whatever, it gives me a Microsoft scripting error telling me that the object is required.   I've tried declaring a variable and pointing it to the document."name" (without the quotes) object and then referencing the properties and/or methods, and same thing.  It's almost as if the DOM is not being recognized.   Is my environment set up wrong?

THANKS!!
0
Comment
Question by:rjdipietro
5 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 10779456
you might be interested n these links

DOM 2 Reference
http://zvon.org/xxl/DOM2reference/Output/index.html

VBScrpt Reference
http://www.sloppycode.net/vbscript/search.php


Im just throwing some ideas at you, maybe you might be able these sites useful


0
 
LVL 22

Expert Comment

by:Snarf0001
ID: 10780108
As a first step, check the spelling of the "name", and make sure it is defined as an ID as well, not just Name.  If you get that error message, it's simply telling you that the element you're requesting does not exist.
0
 

Author Comment

by:rjdipietro
ID: 10780160
Thank you for your response.   Yes, I sort of went through the first troubleshooting steps already.   The spellings and syntax are all ok.  Some of the code actually works in other HTML pages.  I know it sounds crazy, but it's true.   This is what happens when I take my car to the mechanic, too.  :)
0
 
LVL 10

Accepted Solution

by:
Kavar earned 125 total points
ID: 10781055
What I have found with working in this area is that you need to make sure the document is FULLY loaded...

i use a
maxTimeout=10
start=timer
do while ie.busy=true and timer-start<maxtimeout
 wscript.sleep 50
loop
if timer-start=>maxtimeout then
  errOut("Failed to load page fully in a timely manner")
end if
0
 

Author Comment

by:rjdipietro
ID: 10783398
That's it!  The document wasn't fully loaded.   Thanks so much.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
endX challenge 2 63
Currency Conversion? 1 71
SUM 2 INTEGER ARRAYS INTO 1 10 93
C# DataGridView_RowsAdded event not firing 1 64
RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now