473,396 Members | 1,996 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,396 software developers and data experts.

Error msg: null or not an object?

Hi all!!

Could anyone help me with this annoying problem:

When I enter the site www.vans-nordic.com I get this error in the browser:

"document.all[...].style is null or not an object"

This is what the files look like:

Left.htm:
<SCRIPT language=javascript src="menuscript.js" type=text/javascript></SCRIPT>
.....
....
....

menuscript.js:

function lag(lagnavn, bil) // IE4+
{
if (document.all[lagnavn].style.display == 'none') {
document.all[lagnavn].style.display = 'block';
bil.src = 'pics/minus.png';
} else {
document.all[lagnavn].style.display = 'none';
bil.src = 'pics/plus.png';
}
}

function menu(action, menunavn)
{
if (action == "over") { document.all[menunavn].style.backgroundColor = "";}
if (action == "out") { document.all[menunavn].style.backgroundColor = ""; }
}

function skift(hvor, farve)
{
// husk # i kald til funktion
hvor.style.backgroundColor = farve;
}

What´s the problem here??

Thanks!

Allan Bruun
Jul 20 '05 #1
2 48137
Allan Bruun wrote on 30 jun 2003 in comp.lang.javascript:
document.all[menunavn].style.backgroundColor
"document.all[...].style is null or not an object"

Needs a string:

document.all["menunavn"].style.backgroundColor

or:

var menunavn="menunavn"
document.all[menunavn].style.backgroundColor

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
po**@abset.dk (Allan Bruun) writes:
Could anyone help me with this annoying problem:

When I enter the site www.vans-nordic.com I get this error in the browser:

"document.all[...].style is null or not an object"
My first check gave "document.all" has no properties. Then I noticed I had
accidentally used Mozilla instead of Opera. That's a hint: "document.all"
won't work *at all* in Mozilla based browsers.

Which browser are you using?
This is what the files look like:

Left.htm:
<SCRIPT language=javascript src="menuscript.js" type=text/javascript></SCRIPT>
Remember to put quotes around "text/javascript". The language
attribute is deprectaed and can be left out.

menuscript.js:

function lag(lagnavn, bil) // IE4+
{
if (document.all[lagnavn].style.display == 'none') {


So, the error occurs in the call
lag('headlag',document.images['headbil']);
I can't find an an element with id="headlag". That means that
document.all['headlag'] is undefined. The error message is a little
puzzling, as it sounds like it is document.all['headlag'].style that
is undefined, but I think that is just a bad error message. You are
using IE, right?

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tim Mavers | last post by:
I am trying to use the ANTS Profiling service to profile a .NET web app (on my machine). I have XP SP2 with the Firewall turned off (my company's security policy sets this). I have talked to ANTS...
16
by: Paul S. Natanson | last post by:
What is a Null Reference error and how do I fix it? My newly installed VB.Net2003 gives me a "Microsoft Development Environment" error message box EVERY time I try to run/start ANY project -...
0
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) :...
13
by: Challenger | last post by:
Hi I am creating a program in C++ using visual studios 2003, and for a project I am required to create a application. In this application for testing purposes I am outputing a number to show that a...
1
by: ranju | last post by:
I am trying to spawn a process (say an exe file) with different user crendentials than that of the current user. 1) Called LogonUserEx() to logon the user and recieve a handle to the token that...
2
by: getmadhu | last post by:
Hi All... Any one help me with the above weird error I have a code like below print <<"HTML"; Content-type: text/html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html...
3
by: suganya | last post by:
Hi Some professionals already has developed the project using menu. In my company, they have given me task to clear the error in that. It is a script file named as "menubarAPI4.js" which is kept...
5
by: RomeoPapacy | last post by:
I'm trying to write what should be a very simple program - a system tray based menu to allow me to quickly access files in a folder (for me a bunch of disc images). Unfotunately i'm stumped near...
2
by: tridirk | last post by:
Hi; I am getting a Objceted Expected Error on my forum site. I can't find what is wrong? Line: Char: Error: Object expected Code:0 the site is My SMF Forum
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.