Click to See Complete Forum and Search --> : Question
SniperX
07-12-2004, 05:57 AM
Hi there...
How do I run through a page and get co-ordinates of different DIV's...
??
I'm thinking of using GetElementByID...
But I don't know what the ID's are, so how would I find out??
Is this even possible using javascript:?
Thanks
mdw...
gil davis
07-12-2004, 06:04 AM
There is a DOM method called "getElementsByTagName()" that you can use to get an array of all the DIVs (or any other HTML tag) in a page.
SniperX
07-12-2004, 06:07 AM
Thanks.
SniperX
07-12-2004, 06:15 AM
Hi Gil,
Do you know where i may get a list of all javascript functions
that are true to javascript1.2?
Thanks
mdw...
AdamGundry
07-12-2004, 08:07 AM
It doesn't cover JS 1.2, but the latest three versions (1.3 - 1.5) have documentation on Netscape Devedge (http://devedge.netscape.com/central/javascript/).
Adam
gil davis
07-12-2004, 05:00 PM
The JS 1.3 reference is at http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/ . There is a section on what is new. So, what isn't new, is 1.2. ;-)
SniperX
07-13-2004, 01:15 AM
I can now get the properties of the div,
but i cant get the ID's name?
Any ideas?
Thanks
Mdw...
Pittimann
07-13-2004, 01:21 AM
Hi!i cant get the ID's nameWhat do you mean? Do you want to get the id or the name?
You say you are able to get the properties of the div; originally you were asking for coordinates (style attributes?). If you manage to get these by looping through your array, you will have some code like:
var y = blahblah.style.top;
If you want to get the ids, you can use:
var divId = blahblah.id;
Cheers - Pit
SniperX
07-13-2004, 01:27 AM
I figured it out about 2 mins ago:
tagName.getAttributeNode("ID").value;
Thanks for your thoughts...
Pittimann
07-13-2004, 01:29 AM
Hi!
Nice, you got it!
Cheers - Pit