Solved

"object required" in VBScript

Posted on 2004-04-07
5
2,888 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

805 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