473,324 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

runtime error: object required?

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
4 15653
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Carolyn Speakman | last post by:
Hi, I'm trying to amend an intranet .asp page but keep getting this error. The error only occurs when I pull the WHOLE intranet off the server and try to run it locally. The error isn't there...
4
by: Geoff Cox | last post by:
Hello, One person to date has received a runtime error message saying "parent.frameleft.location is not an object" with the following code. The code is used to select 2 frames at the same...
0
by: ann | last post by:
Hi, I am trying to add an ActiveX control on my ASP.NET web form (the language for code behind is C#). I have some client-side vbscript to handle events from the html input buttons. In the...
0
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. ...
0
by: Yong | last post by:
I have a COM DLL written in C++ which worked fine when called from VB6. But we have now moved to Visual Studio 2005 - .NET Framework v2 and Windows XP Pro. In total there are 4 methods in this DLL...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
4
by: Genken | last post by:
Hi can anybody help me i get this error when running this code. Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: '' And then a line number indicating where the error is, i...
1
by: KRISHNA PRAVI | last post by:
the error is "runtime error object expected" here is the code....................................................................................... <script language="javascript"...
4
kcdoell
by: kcdoell | last post by:
Hello: I have the following afterupdate event: Private Sub GWP_AfterUpdate() 'Updates the Total calculation in the control "SumGWP" on the quick reference 'table that is located on the form...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.