Home > object required > object required error in javascript ie

Object Required Error In Javascript Ie

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 About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Internet Explorer 8 error, Object Required (JavaScript) up vote 0 down vote favorite I wrote a todo in chrome that works fine. I tested it in IE8 and it didn't work. So I made a new file to write specifically in IE8, and I can't even get a simple function to work properly. I would like help in finding out what i'm doing wrong. Thank you to anyone that can school me on this. HTML

Home

Javascript var inItemText = document.getElementById("inItemText"); function doIt() { var itemText; itemText = inItemText.value; document.getElementById("p1").innerHTML = itemText; form1.reset(); } javascript internet-explorer internet-explorer-8 share|improve this question asked Jan 30 '15 at 0:25 MrEhawk82 2231317 add a comment| 3 Answers 3 active oldest votes up vote 1 down vote accepted Make sure you do the inItemText assignment after the DOM has been loaded. Otherwise, document.getElementById("inItemText") won't find the element, because it doesn't exist yet. Either put it at the end of the , or use window.onload: var inItemText; window.onload = function() { inItemText = document.getElementById("inItemText"); }; share|improve this answer answered Jan 30 '15 at 0:36 Barmar 273k23126213 add a comment| up vote 0 down vote You're getting that error because inItemText isn't defined. Use document.getElementById('inItemText'). share|improve this answer answered Jan 30 '15 at 0:28 Matt Harper 1178 add a comment| up vote 0 down vote I think the issue is in this line: itemText = inItemText.value; You need to declare "inItemText" a

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 About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up IE throws an “Object required” error http://stackoverflow.com/questions/28227214/internet-explorer-8-error-object-required-javascript when trying to use the Event Object from another window/frame up vote 0 down vote favorite I found a JavaScript error in a script that I'm developing. I whittled it down to a pair of fairly concise pages that still produce the error: http://troy.onespot.com/static/4505/index.html http://troy.onespot.com/static/4505/iframe.html If you load the first page in Internet Explorer 8 (or probably 6 or 7, for that matter), give it about http://stackoverflow.com/questions/3570750/ie-throws-an-object-required-error-when-trying-to-use-the-event-object-from-an half a second to run the script, then click the "Google" link inside of the