LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-06-2005, 03:15 PM   #1
Napalm Llama
Member
 
Registered: Nov 2004
Location: Bristol, UK
Distribution: Gentoo 2005.0
Posts: 224

Rep: Reputation: 30
Discovering position of an element in JavaScript


How's it done?

document.getElementById("some_element").style.top contains it once it's been moved, but not before.

Is there any way of finding out the whereabouts without actually setting them yourself first?
 
Old 09-07-2005, 09:43 AM   #2
pnellesen
Member
 
Registered: Oct 2004
Location: Missouri, USA
Distribution: Slackware 12.2, Xubuntu 9.10
Posts: 371

Rep: Reputation: 31
By "position", do you mean the x-y coordinates of the element in the window, or something else?
 
Old 09-07-2005, 01:38 PM   #3
Post Modern
Member
 
Registered: Nov 2002
Location: Massachusetts
Distribution: Fedora Core, RH, Mandrake, Xandros, Knoppix
Posts: 110

Rep: Reputation: 15
I think....

.
.
I think he means where in the code a particular element is written into the whole composition, like a .jpg reference or how do you find where an element written into the code is located, like a line of script.

It's simple, at least for me - I just add in a few "stop" lines, and at each "stop", when I bring up the index page on my computer (as I'm trying to disect the code for placement) the page stops when it hits the first stop.

IF I'm not where I want to be, I delete the stop, and move it down, and bring up the page again.

Sooner or later, you find the top and bottom of where you want to be, and it doesn't take very long to do....

WHILE I'M DOING THAT:

I add in a few reference lines that don't show up on the page when you open it - like this:

<!-- messages here -->

And, at the end of the section, I add:

<!-- end of section marker -->

You can even get extremely specific, and write in three or four lines of description(s) if you need them, between the left arrow and two dashes and the two dashes and right arrow.

Make your notes as long as you need them, when you bring up the page in a text editor (or whatever you use) they will show up as blue, while the rest of the code is black (or some other color), so they're obvious to see where they are.

And I just keep doing that until I'm thru the entire program, which tells me later on what that particular section has in it if I have to go back in.

And, once I've cut up the code, I can reference them for whatever section I need to change or review by simply refering to the section that's marked with what I'm looking for....

As an interesting note that I've seen written into some pages recently, I notice that SOME references (like a link or a comment) are actually written ONTO a .jpg file, a .gif file or a .png file, with a graphics program, and then linked to with a simple code, like:

<a href-"some jpg or .png file">name of file</a>

That way, when you click on the picture on the page, it acts just like a normal link.

In order to change that kind of link, you actually have to bring up the picture file with your own graphics program, and over write the message put on top of the picture with the authors graphics program.... you remove the addition the original author put on top of the picture, and put your own on it.

If you're working with something like a template, and want to change it so it reads properly for YOUR web site, make sure you either don't change a reference to the original author without permission, or that the change doesn't effect the original authors credit s/he is asking for....

PM
.
.

Last edited by Post Modern; 09-07-2005 at 02:50 PM.
 
Old 09-07-2005, 03:57 PM   #4
Napalm Llama
Member
 
Registered: Nov 2004
Location: Bristol, UK
Distribution: Gentoo 2005.0
Posts: 224

Original Poster
Rep: Reputation: 30
Wow...

Thanks for the really detailed response, but the first person was right - I do just want to find the absolute x,y location on the page of some element, such as a picture or a <div>.

Sorry for not being more specific... (but thanks again!)
 
Old 09-07-2005, 04:59 PM   #5
Post Modern
Member
 
Registered: Nov 2002
Location: Massachusetts
Distribution: Fedora Core, RH, Mandrake, Xandros, Knoppix
Posts: 110

Rep: Reputation: 15
.
.
oops....

You're welcome anyway... at least I tried....



PM
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Discovering unknown host ivanatora Linux - Security 3 04-28-2005 03:19 PM
Discovering sambaSID Tagge Linux - Software 3 03-21-2005 04:15 PM
discovering hosts splat Linux - Networking 1 09-24-2003 09:58 AM
Discovering your IP address for the internet TrashCanMan Linux - Newbie 3 07-13-2003 08:23 AM
Discovering your version... Stephanie Linux - General 4 01-09-2002 09:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration