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

Javascript error in Firefox...please assist

The following script works fine in IE...but gives me a "sBox has no
properties" error in Firefox. sBox is only used in the below method.
function addTop (sectId) {
sBox = document.getElementById("addo_" + sectId);
topo = sBox.options[sBox.selectedIndex].value;
if (topo != '0'){
drawTop(sectId, topo);
} else {
alert('Please select a topic.');
}
}

I can't see the problem...anyone have any suggestions to try? Thanks
for your time.

Aug 1 '05 #1
4 1888
ga******@gmail.com wrote:
The following script works fine in IE...but gives me a "sBox has no
properties" error in Firefox. sBox is only used in the below method.
function addTop (sectId) {
sBox = document.getElementById("addo_" + sectId);
topo = sBox.options[sBox.selectedIndex].value;
if (topo != '0'){
drawTop(sectId, topo);
} else {
alert('Please select a topic.');
}
}

I can't see the problem...anyone have any suggestions to try? Thanks
for your time.

function addTop (sectId) {
topo=document.getElementById("addo_"+sectId).optio ns[sBox.selectedIndex].value;
if (topo != '0'){
drawTop(sectId, topo);
} else {
alert('Please select a topic.');
}
}
Aug 1 '05 #2
ga******@gmail.com wrote:
The following script works fine in IE...but gives me a "sBox has no
properties" error in Firefox. sBox is only used in the below method.
function addTop (sectId) {
sBox = document.getElementById("addo_" + sectId);
topo = sBox.options[sBox.selectedIndex].value;
if (topo != '0'){
drawTop(sectId, topo);
} else {
alert('Please select a topic.');
}
}

I can't see the problem...anyone have any suggestions to try? Thanks
for your time.

function addTop (sectId) {
topo=document.getElementById("addo_"+sectId).optio ns[document.getElementById("addo_"+sectId).selectedIn dex].value;
if (topo != '0'){
drawTop(sectId, topo);
} else {
alert('Please select a topic.');
}
}
Aug 1 '05 #3
<ga******@gmail.com> kirjoitti
viestissä:11**********************@f14g2000cwb.goo glegroups.com...
The following script works fine in IE...but gives me a "sBox has no
properties" error in Firefox. sBox is only used in the below method.
function addTop (sectId) {
sBox = document.getElementById("addo_" + sectId);
topo = sBox.options[sBox.selectedIndex].value;
if (topo != '0'){
drawTop(sectId, topo);
} else {
alert('Please select a topic.');
}
}

I can't see the problem...anyone have any suggestions to try? Thanks
for your time.


Don't know just how many times I've suggested this, but it's always worked.
Make sure you have defined an id for the element. If it has just a name it
works in IE but it is wrong. Unless it has an id attribute it won't work in
Firefox. The error is in IE, not Firefox. But it pleases me to see that
people are more and more testing the pages with Firefox and discovering
these problems.

So if your select looks something like this...
<select name="addo_0">
<option....
</select>

It should be like
<select name="addo_0" id="addo_0">
<option....
</select>

Also, for the future, it would be useful if you presented also an example of
the form, not just the javascript code.

--
SETI @ Home - Donate your cpu's idle time to science.
Further reading at <http://setiweb.ssl.berkeley.edu/>

Soulman <et****************@5P4Mgmail.com>
Aug 1 '05 #4
wrote:
function addTop (sectId) {
sBox = document.getElementById("addo_" + sectId);
topo = sBox.options[sBox.selectedIndex].value;
if (topo != '0'){
drawTop(sectId, topo);
} else {
alert('Please select a topic.');
}
}

I'm assuming Kimmo Laine already gave you the correct answer, but another
minor point is that you probably wanted sBox and topo to be local
variables (i.e. declare them using the 'var' keyword): using global
variables as you do here is a likely way to introduce obscure bugs.
Aug 1 '05 #5

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

Similar topics

1
by: Bob Burkett | last post by:
I cannot get a video to play when I click on it in Internet Explorer or Mozilla. Apparently I have it turned off. How do I turn it on again? Thanks for the help, Bob Burkett
34
by: Steve Horrillo | last post by:
Anyone know where to get a Tool Tips javascript that will pop up a little box when hovered for words that needs more explanation. I'm using Front Page BTW. -- Warmest regards, Steve...
13
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...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
18
by: Chris Ianson | last post by:
Hi geniuses (or is that genii, or genies) The challenge is as above really. I have a page with an iframe in it, and need to call a JS function in the *parent* page, *from* inside the iframe. ...
5
by: geotso | last post by:
Here is the scenario: 1. I have a table (tblCalendar) with the following fields: caldID caldDate caldTitle caldInfo nWinW nWinH
11
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...
1
by: Rotsey | last post by:
Hi, As the subject says I have an application that uses xml at the client to render custom tables to get a drill down effect. So I query my database and create a xml document of it. I then...
2
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...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.