By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,848 Members | 3,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,848 IT Pros & Developers. It's quick & easy.

Firefox get shapes problem.

P: n/a
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.
Oct 3 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

--
sm
Oct 3 '08 #2

P: n/a
Sunny wrote:
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
--
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
Oct 3 '08 #3

P: n/a
On Oct 3, 1:49 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
Sunny wrote:
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
--
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.
Oct 3 '08 #4

P: n/a
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 ?

--
sm
Oct 3 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.