We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
There is a Firefox extension, WebDeveloper. It has one menu item, outline current element. It shows position of element. Example:Firstly, please note that that is not a unique position. If you want to be able to find what was selected/clicked later, you need to use an XPath-like notation; something like:"html > body #id-479 > center > table > tbody > tr > td .main_content > form > table > tbody > tr > td > ul[0]"for an element in this page. "html > body#id-479 > center[0] > table[0] > tbody [0] > tr[1] > td.main_content > form[0] > table[0] > tbody[0] > tr[0] > td[0] > ul" Secondly, roughly the same question was asked by user2000 recently in Position on Web Page. The conclusions are:
And that's just the content-targeting part. The remainder is communicating the "path" string to your perl back-end via AJAX (XMLHttpRequest, etc). Update: I see that like YourMother, I assumed you'd want to remember the XPath-like position in order to translate it to a (browser-relative) pixel-position. If that's not the case, then you can start with something like YourMother has written below (using jquery, or some other library that smooths over browser differences). To be accurate, you will need to form an XPath-like expression, so why not use real XPath? There's a cross-platform library available here. To construct the XPath expression, you'll have to walk up the DOM from the target element to the document.body (root). At each level, you'll need to determine 'id', 'class' and sibling-rank (with that selection priority). -David In reply to Re: Webpage Element Information
by erroneousBollock
|
|