By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,600 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,600 IT Pros & Developers. It's quick & easy.

runtime error: object required?

P: n/a
Hi,

Our webpage uses the following JavaScript code.

function toggleSubmenu(divId, link)
{
var div = document.getElementById(divId);
div.style.display = (div.style.display == 'block') ? "none" :
"block";
if (link.className == "")
link.className = "tempselected";
else
link.className = "";
}

Launching the page in IE pops up the error:

A runtime error has occurred. Do you wish to debug? Line:188
Error: Object required

The line reporting error is:

div.style.display = (div.style.display == 'block') ? "none" : "block";

The version of IE I tested is 6.0.2900.2180.xpsp-sp2-gdr.050301-1519.

The page does not return any errors in other browsers (e.g. Firefox,
Netscape, etc.)

How should I fix the error?

Any help would be greatly appreciated.

Bing

Sep 27 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
du****@gmail.com wrote:

[snip]

A runtime error has occurred. Do you wish to debug? Line:188
Error: Object required

The line reporting error is:

div.style.display = (div.style.display == 'block') ? "none" : "block";


[snip]

Try:
div.style.display=div.style.display=="none"?"":"no ne";

Mick
Sep 27 '05 #2

P: n/a
On Tue, 27 Sep 2005 14:24:52 GMT, Mick White
<mw***********@rochester.rr.com> wrote:
Try:
div.style.display=div.style.display=="none"?"":"no ne";
Mick,

is above short for something else? if yes, could you please spell it
out?!

Thanks

Geoff



Mick


Sep 27 '05 #3

P: n/a
Geoff Cox wrote:
On Tue, 27 Sep 2005 14:24:52 GMT, Mick White
<mw***********@rochester.rr.com> wrote:

Try:
div.style.display=div.style.display=="none"?"":"no ne";

Mick,

is above short for something else? if yes, could you please spell it
out?!

Google: "ternary operator", or "conditional operator".
Mick
Sep 27 '05 #4

P: n/a
On Tue, 27 Sep 2005 18:35:08 GMT, Mick White
<mw***********@rochester.rr.com> wrote:
Geoff Cox wrote:
On Tue, 27 Sep 2005 14:24:52 GMT, Mick White
<mw***********@rochester.rr.com> wrote:

Try:
div.style.display=div.style.display=="none"?"":"no ne";

Mick,

is above short for something else? if yes, could you please spell it
out?!

Google: "ternary operator", or "conditional operator".


Thanks MIck,

Geoff


Mick


Sep 27 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.