Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If 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
 
Old January 12th, 2010, 07:21 AM
Registered User
 
Join Date: Oct 2007
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Smile onMouseOver does not get parameter

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:

checkBoxObject.Atributes.Add("onMouseOver","mouseO verHandler(this)")

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
 
Old February 4th, 2010, 09:04 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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:
Hezi (February 7th, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
onmouseover question??? RinoDM Javascript 3 May 30th, 2008 03:01 AM
onmouseover sstuber BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 April 29th, 2008 12:30 PM
onmouseover gilgalbiblewheel HTML Code Clinic 4 February 4th, 2005 08:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.