ASP.NET 2.0 BasicsIf you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I have a matrix of checkboxes and I would like to get the id of the checkBox on which the mouse is over. I set the onMouseOver handler programmatically by the following C# code in the Page_Load procedure:
The client's MouseOverHandler function (JavaScript) is:
Function mouseOverHandler(me)
{
alert(document.getElementById(me.id))
}
When I move the mouse over a checkbox I get an empty alert box. It seems that the function "mouseOverHandler " does not get the firing checkbox in the parameter"me".
The same code works correctly when I change the triggering event from "onMouseOver" to "onClick".
1. Why does it work with "onClick" and dose not work with "onMouseOver"
2. How can I make it to work with "onMouseOver"
Thank you
Hezi
You are programming your javascript as if it were the code behind. You pass the object, but javascript does not know what .id is. I would just simply pass the ClientID of the checkbox to your js functions.
The Following User Says Thank You to jbenson001 For This Useful Post: