Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

utilizing ID on event 1

Status
Not open for further replies.
Mar 7, 2001
14
US
When an ID is assigned to a TR or a TD, does anyone know how to retrieve and USE the ID on an event? I can't figure out how to pass this value in a manner that it is an object and not a string - so I can use it along with the properties (e.g. IDNAME.Style.Color = "Black").

Example:
We are showing a listing of employees - this will be a flexible number. Each employee has an unique identifier. I've placed my code to create a <TR> for each record, and the ID has been assigned &quot;ENGR&quot; + the Unique Identifier.

When a user moves the mouse over a row, I would like the color to change depicting when the cursor is over it using the onmouseover event.

The problem is that since there are a varying number of rows, I don't have a set number to run a CASE statement against. It would be nice if somehow the parameter of the ID name is passed, and my event script accepts and is able to USE the parameter as the object itself.

Hopefully this makes sense. ;) Thanks for the help.

Nuke


 
I think I understand your question and the answer is pretty simple. When you're creating your TD and assigning it an ID, also give some event code that will pass itself to the function that will do something with it.

Something like this:

... ID=&quot;ENGR&quot; & intLoop & &quot; OnMouseOver='HighlightMe(me)'&quot; & ...

The answer to what you're looking for is the &quot;me&quot; part. Using &quot;me&quot; in VBScript (and using &quot;this&quot; in JavaScript) passes a reference to the element itself.

Then your Highlight function would receive the object:

Sub Highlight(ByRef objElement)
objElement.Style.color = &quot;Black&quot;
End Sub

Hope that helps.
 
That's exactly it (passing the ME part and getting it as an object to the script) - - Thanks a mil!

Nuke
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top