Mel said the following on 4/3/2007 1:37 PM:
On Apr 3, 10:28 am, Randy Webb <HikksNotAtH...@aol.comwrote:
>Mel said the following on 4/3/2007 10:28 AM:
>>I would like to display any item that has ID associated with it on the
top-left corner of its physical location (20px up and 20px right) with
yellow background and red foreground.
Is it possible ? any example is highly appreciated
A better explanation of what you want to do is highly appreciated also.
It is hard to determine what exactly you are trying to describe.
For my debugging purposes. I would like to display element IDs on my
HTML page above and to the left of each element that has id associated
with it with background yellow and foreground red.
So you basically want a permanent tooltip for each element that has an
ID attribute?
other people look at my screen and determine which id is associated
with which field and they can write scripts to do the work.
I am sorry for lack of good explanation
It would be a lot easier to do it server side. As the document is
generated then any element that had an ID attribute could be given a
tooltip like div/span element that contained it's ID attribute.
If server side isn't an option, then you could get a reference to all
the elements in the document:
var allElements = document.getElementsByTagName('*')
And then loop through allElements and if an element had an ID then
create a div element and try to position it. I seem to remember IE6
having some problems with getElementsByTagName('*') but I don't remember
the work around.
Even then, it is going to get messy trying to position your elements.
Why not simply use the title attribute of the elements to display the id?
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -
http://jibbering.com/faq/index.html
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/