Firefox get shapes problem.

S

Sunny

Hi I have a div called shape on my page.
When I try to get its length using javascript in IE, everything works
fine.

But When I try it in Firefox it has element has no properties.

Here is the code that I am using.

var shps = document.getElementsByTagName("shape");
lastshp = shps.length
alert ("there are currently: " + lastshp + " shapes")

In IE It returns 2.
But In Firefox it returns 0.

Why what i am doing wrong here.
 
T

Thomas 'PointedEars' Lahn

Sunny said:
Hi I have a div called shape on my page.
When I try to get its length using javascript in IE, everything works
fine.

But When I try it in Firefox it has element has no properties.

Here is the code that I am using.

var shps = document.getElementsByTagName("shape");
lastshp = shps.length
alert ("there are currently: " + lastshp + " shapes")

In IE It returns 2.
But In Firefox it returns 0.

Why what i am doing wrong here.

("My neighbor has a big car, I don't. What I am doing wrong here?")

Posting in gibberish, coding cluelessly, or both. A `div' is not a `shape',
`shape' is not an HTML element, the tag name (type) of an element is not the
name of this element, and you have provided too little information about
your markup or the position of your script code for an educated guess anyway.

<http://jibbering.com/faq/#FAQ2_3>


PointedEars
 
S

SAM

Le 10/3/08 6:34 PM, Sunny a écrit :
Here is the code that I am using.

var shps = document.getElementsByTagName("shape");

are you shure that "shape" could be a *tag* ?

shape is an *attribute* for an area (in a map)

lastshp = shps.length
alert ("there are currently: " + lastshp + " shapes")

alert('there are currently : '+
document.getElementsByTagName('area').length +
'areas');
In IE It returns 2.

Toujours aussi débile ce IE !
But In Firefox it returns 0.

Of course !
Why what i am doing wrong here.

you're wrong trying to create JS and testing it in IE to see if it is
correct.
 
S

Sunny

("My neighbor has a big car, I don't. What I am doing wrong here?")

Posting in gibberish, coding cluelessly, or both. A `div' is not a `shape',
`shape' is not an HTML element, the tag name (type) of an element is not the
name of this element, and you have provided too little information about
your markup or the position of your script code for an educated guess anyway.

<http://jibbering.com/faq/#FAQ2_3>

PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

You are right i am trying to get the shapes length on map.
In IE, It's giving me the length.
But why it gives 0 in Firefox.
Can you tell me, How to get the length of shapes in firefox.
 
S

SAM

Le 10/3/08 9:46 PM, Sunny a écrit :
Can you tell me, How to get the length of shapes in firefox.

That the length of a shape (or several shapes) could be when we know
that a shape is a geometrical figure

shape='rect'
shape="circle"

where is the length ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,801
Messages
2,569,659
Members
45,427
Latest member
Fredrick95

Latest Threads

Top