Home > object required > document.getelementbyid object required error

Document.getelementbyid Object Required Error

Contents

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site getelementbyid vbscript example About Us Learn more about Stack Overflow the company Business Learn more about ie document getelementbyid vbscript hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join vbscript getelementbyid value the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up document.getElementbyId: Object required up vbscript get element by name vote 1 down vote favorite 1 I have some code on a classic ASP page that is attempting to get the innerHTML of a

element. Dim oElm Set oElm = document.getElementById("screenDiv") if oElm Is Nothing then ''' else document.getElementById("screenDiv").innerHTML = "" end if I've tried the above but I'm getting the Object Required error. What do I need to do to get around this error?

Vbscript Getelementsbyname

vbscript share|improve this question edited Nov 29 '11 at 11:30 Shadow Wizard 49.2k1385130 asked Nov 28 '11 at 23:50 webdad3 3,5421672158 1 Is that server-side? If it is, I don't think you can access document. If it's client-side... don't ever use VBScript client-side. –Ryan♦ Nov 28 '11 at 23:52 yes it is client side. I don't have a choice at this point in time. It is a legacy app that is partially javascript and partially vbscript. –webdad3 Nov 28 '11 at 23:53 1 if this is clientside code then it has nothing to do with ASP-classic which is all serverside. –Dee Nov 29 '11 at 5:48 add a comment| 1 Answer 1 active oldest votes up vote 6 down vote accepted NOTE: client side VBScript is outdated, deprecated, and doesn't work in any modern browser including newer versions of IE. This means the code is located before the element, so when it executes, such element does not exist. To solve this, have the code execute in the onload event:

 

© Copyright 2019|winbytes.org.