Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

client side handlers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Just Me - 12 Dec 2007 23:11 GMT
Hi,

I know this is not an ASP.NET question, but I thought someone might be able
to help.

I need to handle mouseover events etc for table cells.  This is fine and I
can do this ok, my question is ifI can do it easier.

I have a table with hundreds of cells and I dont want to have to render the
whole table with as many onmouseover="functionName(this)" as there are
cells.

Does anyone know of a way of arranging things so that any cell mousover for
example will call the same function but send its own element to the
function.  ?

Cheers
Peter Bromberg [C# MVP] - 13 Dec 2007 02:01 GMT
I'm not aware of any, although its possible somebody smarter than me may
offer a way. Basically, you have to attach the onmouseover client script
event to each element.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com 

> Hi,
>
[quoted text clipped - 13 lines]
>
> Cheers
bruce barker - 13 Dec 2007 04:35 GMT
you can by capturing the mouse, but then you need to walk the dom
calculating what element the mouse is over. this would be too slow.

you could attach the handlers with a simple javascript routine:

var tbl = document.getElementById('tableid');
var cells = tbl.getElementsByTagName('td');
for (var i=0; i < cells.length; ++i)
{
    cells[i].onmouseover = function(){ functionName(this); };
}

-- bruce (sqlwork.com)

> Hi,
>
[quoted text clipped - 13 lines]
>
> Cheers
Just Me - 15 Dec 2007 18:12 GMT
Thanks Bruce.

Actually, I found that I can simply attach the routine to the TR element,
and then interrogate the event object to discover the srcElement.

Cheers

> you can by capturing the mouse, but then you need to walk the dom
> calculating what element the mouse is over. this would be too slow.
[quoted text clipped - 27 lines]
>>
>> Cheers

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.