MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

client side handlers

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet
Author Message
Just Me



Joined: 08 Aug 2007
Posts: 7

PostPosted: Thu Dec 13, 2007 4:11 am    Post subject: client side handlers Reply with quote

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

Archived from group: microsoft>public>dotnet>framework>aspnet
Back to top
View user's profile Send private message
Peter Bromberg [C# MVP]



Joined: 31 Oct 2007
Posts: 22

PostPosted: Wed Dec 12, 2007 11:01 pm    Post subject: RE: client side handlers Reply with quote

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


"Just Me" wrote:

> 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
>
>
>
Back to top
View user's profile Send private message
bruce barker



Joined: 08 Aug 2007
Posts: 10

PostPosted: Thu Dec 13, 2007 1:35 am    Post subject: Re: client side handlers Reply with quote

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)



Just Me wrote:
> 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
>
>
Back to top
View user's profile Send private message
Just Me



Joined: 08 Aug 2007
Posts: 7

PostPosted: Sat Dec 15, 2007 11:12 pm    Post subject: Re: client side handlers Reply with quote

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


"bruce barker" wrote in message
news:%23QVAWGUPIHA.2376@TK2MSFTNGP02.phx.gbl...
> 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)
>
>
>
> Just Me wrote:
>> 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

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Client side scripting problem.. I'm very new at web programming, but I was working through an example from Beginning VB.net and hit a wall. In the example, you setup 2 text boxes and 2 pushbuttons. All that happens is the text in the boxes changes when you hit the pushbuttons, but one r

Sending Client Side Event ? Hello Folks... From my control i need notify client side script about some events occurs. Any idea ? Regards Genival Carvalho Ps. Sorry my bad English.

UserControl... where is the clientID on the client side? [ASP.Net 2.0, WAP, Atlas] I have a custom usercontrol that looks something like this: <%@ Control Language="vb" %>

How to configure a SOAP extension to run on the client side? Hello, I could not find anywhere instructions how to apply a soap extension to run on the client. All explanations that I have encountered so far explain the operation of a soap extension on the client or the server. But when it comes to explaining how to

Encrypting a specific field in a struct at client side Hi, Does anyone do encryption a specific field of a structure at webservice client. For example, webservice expose the below class: public EncryptTest{ int a; int b; string str; } I would like to encrypt only "str" field at web service client only. Is i
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group