473,569 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Netscape 7.1 getElementById Error

Hi,

I have a javascript function which uses the method
document.getEle mentById.

I'm using it to decide whether a checkbox has been ticked or not. This
decision is encoded in an if statement with the condtion being
if (document.getEl ementById(check boxtoupdate).va lue ==1)
/* The Code */

function set(object)
{
var checkboxtoupdat e = object.value;

if (document.getEl ementById(check boxtoupdate).va lue ==1)
document.getEle mentById(checkb oxtoupdate).val ue = 0;
else
document.getEle mentById(checkb oxtoupdate).val ue = 1;
}

The "object" accesses a html tag which has an value attribute e.g
value="7400"

However Netscape Navigator 7.1 does not seem to recognise
"document.getEl ementById(check boxtoupdate).va lue"
and reports an error that
document.getEle mentById(checkb oxtoupdate).val ue has no properties.

But Internet Explorer has no problem with this at all.

Is there another way to do this so as to be recognised by Netscape
7.1?
Jul 23 '05 #1
7 1337
On 7 Apr 2004 02:30:10 -0700, Gerry wrote:

[cut]
function set(object)
{
var checkboxtoupdat e = object.value;

if (document.getEl ementById(check boxtoupdate).va lue ==1) [cut] The "object" accesses a html tag which has an value attribute e.g
value="7400"

However Netscape Navigator 7.1 does not seem to recognise
"document.getEl ementById(check boxtoupdate).va lue"
and reports an error that
document.getEle mentById(checkb oxtoupdate).val ue has no properties.
It's right.
But Internet Explorer has no problem with this at all.


The behavior of IE is wrong. Or better, it doesn't fit standards.

From W3C:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods (".").

--
C'ya,
ZER0 :: coder.gfxer.web Designer();

Deformazione professionale è:
Quando in ascensore senti la ragazza accanto che tira fuori il cellulare,
e ti volti per capire se e' un modello sul quale puoi sviluppare in J2ME.
Jul 23 '05 #2


Gerry wrote:

I have a javascript function which uses the method
document.getEle mentById.

I'm using it to decide whether a checkbox has been ticked or not. This
decision is encoded in an if statement with the condtion being
if (document.getEl ementById(check boxtoupdate).va lue ==1)
/* The Code */

function set(object)
{
var checkboxtoupdat e = object.value;

if (document.getEl ementById(check boxtoupdate).va lue ==1)
document.getEle mentById(checkb oxtoupdate).val ue = 0;
else
document.getEle mentById(checkb oxtoupdate).val ue = 1;
}

The "object" accesses a html tag which has an value attribute e.g
value="7400"


Is there any element in the page that has
<tagname id="7400">
?? I guess you don't have one but only
<tagname name="7400">
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3
Ivo
"Gerry" wrote
I'm using it to decide whether a checkbox has been ticked or not.
There is a word for that in javascript: checked. It is an ordinary
read/write property of any element that can be ticked and unticked. For
example this line
if(obj.checked= =true) obj.checked= false
would see whether the object "obj" is currently ticked, and if so, untick
it.
function set(object)
{
var checkboxtoupdat e = object.value;
So checkboxtoupdat e is a value. Fine.
if (document.getEl ementById(check boxtoupdate).va lue ==1)
So checkboxtoupdat e not only *is* but also *has* a value of its own. Eh? Did
you not mean:
if (document.getEl ementById(objec t).value ==1)
document.getEle mentById(checkb oxtoupdate).val ue = 0;
else
document.getEle mentById(checkb oxtoupdate).val ue = 1;
}

The "object" accesses a html tag which has an value attribute e.g
value="7400"
That would be the checkboxtoupdat e variable then.
However Netscape Navigator 7.1 does not seem to recognise
"document.getEl ementById(check boxtoupdate).va lue"
and reports an error that
document.getEle mentById(checkb oxtoupdate).val ue has no properties.

But Internet Explorer has no problem with this at all. Is there another
way to do this so as to be recognised by Netscape 7.1?


No idea why this works in IE.
Ivo
Jul 23 '05 #4

I beleive your code should be

function set(object)
{
var checkboxtoupdat e = object.value;

if (document.getEl ementById(check boxtoupdate).ch ecked ==true)
document.getEle mentById(checkb oxtoupdate).che cked = false;
else
document.getEle mentById(checkb oxtoupdate).che cked = true;
}
--
Andy

"Gerry" <ge************ @mail.dcu.ie> wrote in message
news:10******** *************** **@posting.goog le.com...
Hi,

I have a javascript function which uses the method
document.getEle mentById.

I'm using it to decide whether a checkbox has been ticked or not. This
decision is encoded in an if statement with the condtion being
if (document.getEl ementById(check boxtoupdate).va lue ==1)
/* The Code */

function set(object)
{
var checkboxtoupdat e = object.value;

if (document.getEl ementById(check boxtoupdate).va lue ==1)
document.getEle mentById(checkb oxtoupdate).val ue = 0;
else
document.getEle mentById(checkb oxtoupdate).val ue = 1;
}

The "object" accesses a html tag which has an value attribute e.g
value="7400"

However Netscape Navigator 7.1 does not seem to recognise
"document.getEl ementById(check boxtoupdate).va lue"
and reports an error that
document.getEle mentById(checkb oxtoupdate).val ue has no properties.

But Internet Explorer has no problem with this at all.

Is there another way to do this so as to be recognised by Netscape
7.1?
Jul 23 '05 #5
Andy wrote:
I beleive your code should be
You would believe wrong.
function set(object)
{
var checkboxtoupdat e = object.value;

if (document.getEl ementById(check boxtoupdate).ch ecked ==true)
document.getEle mentById(checkb oxtoupdate).che cked = false;
else
document.getEle mentById(checkb oxtoupdate).che cked = true;
}


checkboxtoupdat e is a value of an element, as such, it has no "checked"
property.

And all of it is totally dependent on how object gets passed.

set(this.value) ;
set(this);
set('objectName );

And without knowing how set is called, and how object is passed, its
anybody's guess as to the problem.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/
Jul 23 '05 #6
Hi again,

Thanks for your replys,
checkboxtoupdat e is a value of an element, as such, it has no "checked"
property.

And all of it is totally dependent on how object gets passed.

set(this.value) ;
set(this);
set('objectName );

The object gets passed like this (in the webpage that is)
OnClick="parent .videoDetailSub mit.set(this)"

The full tag is as below.

The id is a different number for each checkbox.

<input type="checkbox" name="tom" id="{keyFrame/frame}"
value="{startTi me}" OnClick="parent .videoDetailSub mit.set(this)"</input>
a real example of the values for this:
<input OnClick="parent .videoDetailSub mit.set(this)" value="7400"
id="366" name="tom" type="checkbox" >

In my code though i'm using the value attribute ,which 99.9% of the
time is unique but,in theory, it could be the same value for both
checkboxes, but when I try and use the unique "id" value , neither IE
or Netscape can seem to pick up on this with getElementById( object.id)
Why ever this happens I dont know.
Gerry.

Randy Webb <hi************ @aol.com> wrote in message news:<da******* *************@c omcast.com>... Andy wrote:
I beleive your code should be


You would believe wrong.
function set(object)
{
var checkboxtoupdat e = object.value;

if (document.getEl ementById(check boxtoupdate).ch ecked ==true)
document.getEle mentById(checkb oxtoupdate).che cked = false;
else
document.getEle mentById(checkb oxtoupdate).che cked = true;
}


checkboxtoupdat e is a value of an element, as such, it has no "checked"
property.

And all of it is totally dependent on how object gets passed.

set(this.value) ;
set(this);
set('objectName );

And without knowing how set is called, and how object is passed, its
anybody's guess as to the problem.

Jul 23 '05 #7
On 8 Apr 2004 01:43:39 -0700, Gerry <ge************ @mail.dcu.ie> wrote:
The object gets passed like this (in the webpage that is)
OnClick="parent .videoDetailSub mit.set(this)"

The full tag is as below.

The id is a different number for each checkbox.

<input type="checkbox" name="tom" id="{keyFrame/frame}"
value="{startTi me}" OnClick="parent .videoDetailSub mit.set(this)">
</input>
INPUT elements do not, and cannot, have closing tags.

HTML: <input ...>
XHTML: <input ... />
a real example of the values for this:
<input OnClick="parent .videoDetailSub mit.set(this)" value="7400"
id="366" name="tom" type="checkbox" >

In my code though i'm using the value attribute ,which 99.9% of the
time is unique but,in theory, it could be the same value for both
checkboxes, but when I try and use the unique "id" value , neither IE
or Netscape can seem to pick up on this with getElementById( object.id)
Why ever this happens I dont know.


First, read ZER0's post; id values are illegal.

Second, why would you want to perform

document.getEle mentById( object.id );

where object is an element reference? It will simply return object, and so
the call will just be an expensive waste of time.

You've now managed to confuse the issue in my mind. First, it appeared
that the value of a control represented the id of another, and you wanted
to get a reference to that control through:

document.getEle mentById( object.value );

Now it appears that you want a reference to element passed, which you
already have in "object".

Mike
Please, don't top-post.

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #8

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

Similar topics

7
3676
by: Scott | last post by:
Hello All, I've been reading all of the various issues with Iframes in netscape. I have tried all of the various fixes posted, and have even implemented both an iframe and ilayer. My problem is that no matter which i use, i can access the src before and after i change it, but the page never displays. in IE6 it works no matter how i access...
10
1610
by: Todd Cary | last post by:
This JavaScript slideshow works with Netwcape; not IE. Is there some obvious that is missing? http://209.204.172.137/slideshow/slideshow.html Todd
7
1120
by: Rick | last post by:
This script works with IE but not Netscape anyone know what I am doing wrong? If so could you help me out I am at a lost? Thanks in advance. The error is as follow Error: pen0 has no properties Line: 73
4
5453
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) { document.getElementById(nameOfDiv).style.visibility='visible'; document.getElementById(nameOfDiv).style.height='auto'; if (nameOfDiv != 'weblogs')
26
2164
by: Roger Desparois | last post by:
Hi, I need help : I found the simplest and most precise way to open and close submenu layers. it works perfectly with IE, but for some odd reason NS won't recognize it. Can anyone tell me why ? And is there a way around the problem ?
2
1304
by: BTHOMASinOHIO | last post by:
In IE, this runs fine, but in Netscape, it doesn't error, but just doesn't run. WHY?!?! (in the Page Code Behind) BODY1.Attributes.Add("onLoad", "DisplayData();") (in the HTML of the Page) function DisplayData(){
5
1647
by: zaw | last post by:
Hi I am working on implementing this script to shopping cart. Basically, it copies fill the shipping address from billing automatically. I believe one or more syntax is not netscape compatible. Can anyone point out which one it is and how to make it both netscape and MS browser compatible? I hope if I can make the script compatible for those...
3
2154
by: Ron M | last post by:
I am sure this is a simple issue, but being a beginner I am struggling. In the following js function I am attempting to make sure no numbers are within "name" controls. I want to pass the text value of the HTML control and the control name into the function: function CheckForNumbers (strString, strField) { var result = true; var validNums =...
8
376
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I detect Opera/Netscape/IE? ----------------------------------------------------------------------- The « navigator » object contains strings which specify the browser and version; however, this is in general not very genuine. Mozilla (and therefore...
0
7701
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, 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...
1
7677
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...
0
7979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
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...
0
5219
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...
0
3653
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...
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
bsmnconsultancy
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...

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.