Home > object expected > internet explorer 7 script error object expected

Internet Explorer 7 Script Error Object Expected

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 object expected error in javascript in ie8 this site About Us Learn more about Stack Overflow the company Business object expected error in javascript while calling a function Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask object expected error in javascript onclick Question x Dismiss Join 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

Object Expected Error In Jquery

up Internet Explorer 7+ returns the error “Object expected” although none of the other browsers do up vote 1 down vote favorite Each time I load a page in Internet Explorer 7 or greater I get the error Object Expected when calling the function below. The script appears right at the bottom of the page before the closing tag. There are no object expected error in node js elements with the same name or id. The Javascript function it is attempting to call is function show() { obj1 = document.getElementById("container").innerHTML = '

Hello World.
Here I am.

' + '

test

'; } Why does this error not appear in any of the other browsers? What do I need to change to resolve the issue? EDIT 0 If I move the function show into the same block at window.onload, hide() now no longer works. Javascript code function show() { obj1 = document.getElementById("container").innerHTML = '

Hello World.
Here I am.

' + '

test

'; } function hide() { obj1 = document.getElementById("container"); if(obj1){ alert("Hi"); obj1.style.display = "none"; obj1.style.visibility = "hidden"; }else{ alert("Cannot find the element with id container."); } } HTML code takeover