473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

need to display id of the element under the pointer below the current pointer location

Mel
Is there a way of displaying the id of the element under the pointer ?

Please dont ask why I need it, but I do, i found tools that needs
installation that provide the same funcitonality. However, I would
like to turn on this feature using a flag in my url. Something like
debug=1.

thanks for your help

Apr 21 '07 #1
5 4742
Mel wrote:
Is there a way of displaying the id of the element under the pointer ?

Please dont ask why I need it, but I do, i found tools that needs
installation that provide the same funcitonality. However, I would
like to turn on this feature using a flag in my url. Something like
debug=1.
Perhaps something along the lines of:

var el = document.getElementsByTagName('*');
for (var i = el.length - 1; i -1; i--) {
if (el[i].id) {
el[i].title = el[i].id;
}
}

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Apr 21 '07 #2
On Apr 21, 2:59 am, Mel <MelHer...@gmail.comwrote:
Is there a way of displaying the id of the element under the pointer ?

Please dont ask why I need it, but I do, i found tools that needs
installation that provide the same funcitonality. However, I would
like to turn on this feature using a flag in my url. Something like
debug=1.

thanks for your help
try-

document.onmouseover=function(Event){
Event=(Event||event)
Eleme=Event.srcElement||Event.target
if(Eleme){
var idS=document.getElementById("showID")
idS.innerHTML="ID: "+(Eleme.id||"not found")
idS.style.display=''
idS.style.top= Event.clientY+10
idS.style.left=Event.clientX+10
}
}
document.onmouseout=function(){
document.getElementById("showID").style.display='n one'
}

Apr 21 '07 #3
Mel
On Apr 21, 7:16 am, "scripts.contact" <scripts.cont...@gmail.com>
wrote:
On Apr 21, 2:59 am, Mel <MelHer...@gmail.comwrote:
Is there a way of displaying the id of the element under the pointer ?
Please dont ask why I need it, but I do, i found tools that needs
installation that provide the same funcitonality. However, I would
like to turn on this feature using a flag in my url. Something like
debug=1.
thanks for your help

try-

document.onmouseover=function(Event){
Event=(Event||event)
Eleme=Event.srcElement||Event.target
if(Eleme){
var idS=document.getElementById("showID")
idS.innerHTML="ID: "+(Eleme.id||"not found")
idS.style.display=''
idS.style.top= Event.clientY+10
idS.style.left=Event.clientX+10
}
}
document.onmouseout=function(){
document.getElementById("showID").style.display='n one'

}- Hide quoted text -

- Show quoted text -
Thats a nice piece of code. thanks a whole bunch.
I tried it with my app and i keep getting "Object Required" error
message.
Should I be making changes to your code or should it work the way it
is ?

i truely appreciate your help

Apr 21 '07 #4
On Apr 21, 12:27 pm, Mel <MelHer...@gmail.comwrote:
>
document.onmouseover=function(Event){
Event=(Event||event)
Eleme=Event.srcElement||Event.target
if(Eleme){
var idS=document.getElementById("showID")
idS.innerHTML="ID: "+(Eleme.id||"not found")
idS.style.display=''
idS.style.top= Event.clientY+10
idS.style.left=Event.clientX+10
}
}
document.onmouseout=function(){
document.getElementById("showID").style.display='n one'
}-

Thats a nice piece of code. thanks a whole bunch.
I tried it with my app and i keep getting "Object Required" error
message.
Should I be making changes to your code or should it work the way it
is ?

Create a div with id showID and style: position:absolute.

This should work:

<html><body id="BodyElement">
<script>
document.onmouseover=function(Event){
Event=(Event||event)
Eleme=Event.srcElement||Event.target
if(Eleme){
var idS=document.getElementById("showID")
idS.innerHTML="ID: "+(Eleme.id||"not found")
idS.style.display=''
idS.style.top= Event.clientY+10
idS.style.left=Event.clientX+10
}
}
document.onmouseout=function(){
document.getElementById("showID").style.display='n one'
}
</script>

<a id="a_element">A Element</a><br>

<span id="span element">nt </span><b id="bold-text">BOLD TEXT</b>
<div id="showID" style="position:absolute;border:1px dashed
gray;background-color:white"></div>

</body></html>

Apr 21 '07 #5
Mel
On Apr 21, 2:00 pm, "scripts.contact" <scripts.cont...@gmail.com>
wrote:
On Apr 21, 12:27 pm, Mel <MelHer...@gmail.comwrote:


document.onmouseover=function(Event){
Event=(Event||event)
Eleme=Event.srcElement||Event.target
if(Eleme){
var idS=document.getElementById("showID")
idS.innerHTML="ID: "+(Eleme.id||"not found")
idS.style.display=''
idS.style.top= Event.clientY+10
idS.style.left=Event.clientX+10
}
}
document.onmouseout=function(){
document.getElementById("showID").style.display='n one'
}-
Thats a nice piece of code. thanks a whole bunch.
I tried it with my app and i keep getting "Object Required" error
message.
Should I be making changes to your code or should it work the way it
is ?

Create a div with id showID and style: position:absolute.

This should work:

<html><body id="BodyElement">
<script>
document.onmouseover=function(Event){
Event=(Event||event)
Eleme=Event.srcElement||Event.target
if(Eleme){
var idS=document.getElementById("showID")
idS.innerHTML="ID: "+(Eleme.id||"not found")
idS.style.display=''
idS.style.top= Event.clientY+10
idS.style.left=Event.clientX+10
}
}
document.onmouseout=function(){
document.getElementById("showID").style.display='n one'
}
</script>

<a id="a_element">A Element</a><br>

<span id="span element">nt </span><b id="bold-text">BOLD TEXT</b>

<div id="showID" style="position:absolute;border:1px dashed
gray;background-color:white"></div>

</body></html>- Hide quoted text -

- Show quoted text -
Thanks for the feedback. It tends to work fine on the top of a long
page. however as I scroll down absolute position kicks in and it
displays it in the scrolled area that is not visible !

do you have a Vaccine for this ?

Many Many thanks

Apr 21 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DMD | last post by:
How do I determine the column associated with the current edit location within a RichTextBox? The following code allow me to determine the current line txtLineNumber.Text =...
11
by: Edd | last post by:
Hello all, I've made a data structure and an associated set of functions to enable me to store a dynamically-sized array of elements of whatever data type I like. Well that's the idea anyway......
16
by: Dave | last post by:
I'm having a problem trying to set up code in VB to handle the case where an argument in an API definition is defined as a pointer to a pointer. An excerpt from the API's definition is: void...
16
by: jimjim | last post by:
#include <stdio.h> #include <stdlib.h> //WARNING: The function's signature should be: f( int ** ) void f(int *ip) { static int dummy = 5; *ip = &dummy; } int main(){
1
by: harter.jim | last post by:
I am currently calling a 3rd party external library using P/Invoke. The library gives me a handful of functions that I need to call. I have been successful at calling many of them, but I am some...
1
by: Simon | last post by:
Dear Access friends, How can I load a string with his own folder address. The following code addressed to the system folder of MS programs.
0
by: dave.kehring | last post by:
So many threads about this with few answers. Here's how I solved my problem. I was trying to create an ASP.NET website on one of my servers from Visual Studio.NET 2003 on my development machine....
9
by: decker | last post by:
People, In the below code, I would like to know how I can return correctly the two-dim array. Anyone can help me? /*************/ int **ReturnIntPointer(int **array); int main(){ int...
6
by: worlman385 | last post by:
For pointer and non-pointer initialization of an object like MyCar mycar; MyCar* mycar = new MyCar(); I heard from other people saying if object i create must live outside scape, then I use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.