473,888 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript Error in FireFox

Hi, I have a menu that toggles correctly in IE but is failing in
FireFox V.1 and Netscape 7.1. The FireFox JavaScript Console is
returning the following error; Error: document.getEle mentById(showDi v)
has no properties.

Any advice would be much appreciated. Here is the snippet of applicable
<script language="javas cript">

function toggleDiv( showDiv, hideDiv, showTab)
document.getEle mentById(showDi v).style.displa y = '';
document.getEle mentById(hideDi v).style.displa y = 'none';
document.getEle mentById("newsT D").backgrou nd =
'/Images/Banner/240_t_tab_' + showTab + '.gif'

function openWindow(file name, name, width, height)
windowops =
eval("'toolbar= no,location=no, directories=no, status=no,menub ar=no,scrollbar s=no,resizable= no,width="
+ width + ",height=" + height + "'");
var newWindow = window.open(fil ename, name, windowops);
newWindow.focus ();
newWindow = '';
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<!-- News listing -->
<td rowspan="2" align="right" valign="top" width="253"><br >
<table border="0" cellpadding="0" cellspacing="0"
<td align="center">
<%= w3ss.putField(" addBannerLink2" ) %><br>
<%= w3ss.putField(" catalogLink") %> <br>
<td id="newsTD"
background="/Images/Banner/240_t_tab_1.gif " width="100%" height="17">
<table border="0" cellpadding="0" cellspacing="0"
<td width="120" style="cursor:h and;"
onclick="javasc ript:toggleDiv( 'memberNews', 'intheNews', '1' );"><img
border="0" src="/Images/Banner/1x1_transp.gif" width="5"
height="1"><spa n class="menuTab" ><%= w3ss.putField(" newsCaption")
<td width="120" style="cursor:h and;"
onclick="javasc ript:toggleDiv( 'intheNews', 'memberNews', '2' );"><img
border="0" src="/Images/Banner/1x1_transp.gif" width="5"
height="1"><spa n class="menuTab" ><%= w3ss.putField(" inthenewsCaptio n")
<td width="100%"
background="/Images/Banner/240_m_tab.gif"> <ul>
<div id="membernews " class="ingress" >
ficpa.renderNew sList(Document. Fields("memberN ewsFolders"), "title", "",
"", false, Document.Fields ("maxMemNewsIte m"), "publishTim e", false ) %>
<img src=/images/banner/bul.gif
border=0>&nbsp; &nbsp;<a href="<%=ficpa. siteURL()%>Top_ Stories">Recent
top stories</a>

<div id="inthenews" style="display: none;"
class="ingress" >

Jul 23 '05 #1
2 7432
"Cy" <we******@gmail .com> wrote:
onclick="javasc ript:toggleDiv( 'memberNews', 'intheNews', '1' );"><img <div id="membernews " class="ingress" >

id is case-sensitive.
Jul 23 '05 #2
On 8 Dec 2004 14:54:20 -0800, Cy <we******@gmail .com> wrote:
Hi, I have a menu that toggles correctly in IE [...]
It shouldn't.
The FireFox JavaScript Console is returning the following error; Error:
document.getEle mentById(showDi v) has no properties.
The value of an id attribute should be treated as case-sensitive. When you
call the script, you're looking for 'memberNews' and 'intheNews', however
the actual ids are 'membernews' and 'inthenews'. Change one or the other.


Some other comments...
<script language="javas cript">
The language attribute has been deprecated for over six years. Use the
type attribute instead:

<script type="text/javascript">
function toggleDiv( showDiv, hideDiv, showTab)
document.getEle mentById(showDi v).style.displa y = '';
document.getEle mentById(hideDi v).style.displa y = 'none';
You should test for browser support before use DOM properties and methods.
One simple alternative is:

if(!document.ge tElementById) {
document.getEle mentById = function() {return null;};

function setStyle(elemen t, property, value) {
element = document.getEle mentById(elemen t);
if(element.styl e) {element.style[property] = value;}


setStyle(showDi v, 'display', '');
setStyle(hideDi v, 'display', 'none');
document.getEle mentById("newsT D").backgrou nd
The background property/attribute is deprecated, as is much of the mark-up
you've shown in this post. All modern documents on the Web should written
to the Strict DTD. Transitional HTML was only meant to be used for a
limited time, and that time has passed (in my opinion, at least).
= '/Images/Banner/240_t_tab_' + showTab + '.gif'
The same effect could be achieved with:

setStyle('newsT D', 'backgroundImag e',
'url(/Images/Banner/240_t_tab_' + showTab + '.gif)');
function openWindow(file name, name, width, height)
Opening new windows is becoming a very bad idea on the Web. There are many
pop-up blockers that do not discriminate between requested and unrequested
pop-ups, and many users dislike them either way.
windowops = eval("'toolbar= no,location=no, directories=no, status=no,'
+ menubar=no,scro llbars=no,resiz able=no,width=" + width
+ ",height=" + height + "'");
The eval call isn't needed. The feature string could also be *much*
shorter. However, removing window chrome - particularly the scrollbars and
status bar - and attempting to prevent resizing is a bad idea. At a
minimum, it should be:

var features = 'status,scrollb ars,resizable,w idth=' + width
+ ',height=' + height;

Unspecified features (with a couple of exceptions) will be disabled by
var newWindow = window.open(fil ename, name, windowops);
newWindow.focus ();
newWindow = '';
That's unnecessary: when the function returns, local variables are
That's unnecessary, too.

<%= w3ss.putField(" addBannerLink2" ) %><br>
<%= w3ss.putField(" catalogLink") %> <br>
There's not really much point including server-side code unless you have a
Javascript-related question about it.

<td width="120" style="cursor:h and;"
The correct property value is 'pointer'.
onclick="javasc ript:toggleDiv( 'memberNews', 'intheNews', '1' );">

The majority of user agents will just see javascript: as a label. Unless
you're also using client-side VBScript (which is a bad idea, anyway), even
IE will ignore it.


[1] Unless a closure is involved, which it isn't.

Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3

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

Similar topics

by: Howard Kaikow | last post by:
Yesterday, I decided to try Firefox. I've encountered a behavior that is either a bug in Firefox or a bug in my Javascript code. I'll try to explain the problem, hoping that this newsgroup can (in)validate my Javascript code. First, I'll describe the purpose of the Javascript code. I often have a need to post a URL to something at my own web site, e.g., http://www.standards.com/Sorting/SortPerformanceComparison-Description.html. It is...
by: LRW | last post by:
(Sorry if this is a repost...my newsreader keeps crashing on the posting--I don't know if the message going out or not) For some reason this javascript just won't work in Firefox. It works fine in IE, though. I know, IE is a bit more permissive than IE, and sometimes lets errors work when they shouldn't. But from what I can see, I just don't see what's wrong.
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I have been able to come. I added a little asp.net code and an asp.net button and cannot get it to
by: ivan | last post by:
AJAX is a stupid and confusing word. People is wondering for something that programmers have used for many years. Javascript + Xml and asynchronous requests is not new. People started to speak about AJAX a lot after XmlHttpRequest was introduced, so AJAX cant'be Javasript+xml+xmlhttprequest. But if you still think so, you can't anyway call this AJAX. What is new with xmlhttprequest is the possibility to perform a synchronous request! (but...
by: Roger Withnell | last post by:
This is a framed webpage with the navigation bar in "NavBar" and the main window in "Main". When opening a new page in "Main" from "NavBar" with: function OpenFrameWindow(src) { var NewWindow = window.open(src, "Main"); NewWindow.focus(); }
by: John Smith | last post by:
I am using IE 6.0 from http://www.javaworld.com/javaworld/jw-07-1996/jw-07-javascript-p2.html I gather that "If you need to test a number of command lines, you can reduce the keystrokes by typing javascript: (remember the colon) in the Location box. Navigator displays a "JavaScript typein" frame at the bottom of the window. Type the command line you want to try, and press Enter. "
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
by: Coder | last post by:
Hi I have the following code in java script, it is not giving proper output in FIREFOX but running fine in IE... can anybody help me out to make this run in FIREFOX . <script language="JavaScript"> var cntlName; var eleTarget = document.getElementById('hiding'); function showOrHide(){
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and no buttons react to clicking. The website's helpdesk says it should work with Firefox, and could not offer any more advices. The JavaScript Console shows that there are numerous errors occuring. It looks like the web browser does not recognise...
by: joelkeepup | last post by:
Hi, I made a change this morning and now im getting an error that says either "a is undefined or null" or "e is undefined or null" the microsoft ajax line is below, I have no idea how to figure this problem out. Any suggestions? thanks Joel
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.