Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Create Function to return Object ID of Selected HTML Object


Message #1 by john.duckett@i... on Tue, 13 Mar 2001 16:54:45
I am in need of code for a function that will return the ID of a selected 
object(Graphic, layer, text field, etc).  For example, in the layer:
<div ID="MYLAYER" align="center"><center><p><font SIZE="4">
The id = mylayer would be returned by the function.

My application the page could have many objects, so a two step process 
would be used.

The steps would be.
First, I would click on, i.e., select an object, graphic, layer, textfield 
etc.
Second, click a button on my page to get the objects ID.  The button would 
have an onClick="getObjectid(this)"  The work would be done by the 
getObjectid function.  The object reference "this" would be passed to the 
function which would evaluate and return the objects id.

It needs to work only for the IE 4.0 browser and above.  

I am especially in need of code snippets that might work. I would prefer 
JavaScript, but...  I have not found anything that works, but believe it 
should not be hard to do.
Any and all ideas, suggestions would be appreciated.

  Return to Index