Asp.net|datagrid completion function is the DataGrid page selection event, mouse event, double-click event to change the color of tr. The code is very simple, just a little JS operation.
/*------------DataGrid mouse Event handling------------
Function: For data-bang-after mouse events
Parameter description:
Obj: Yes like this
FontColor: Font Color
BackColor: Background Color
----------------------------------------------*/
var objstate
When------------mouse passes-----------
function Onfoucsmouseover (Obj,fontcolor,backcolor)
{
if (Obj.rowindex > 0)
{
Obj.style.color = FontColor;
Obj.style.backgroundColor = BackColor;
}
}
-----------the mouse is left-----------
function Onfoucsmouseout (Obj,fontcolor,backcolor)
{
if (Obj.rowindex > 0)
{
if (obj!= objstate)
{
Obj.style.color = FontColor;
Obj.style.backgroundColor = BackColor;
}
}
}
-----------Mouse click-----------
function Onfoucsclick (Obj,fontcolor,backcolor)
{
if (Obj.rowindex > 0)
{
if (objstate!= null)
{
ObjState.style.color = "";
ObjState.style.backgroundColor = "";
}
Obj.style.color = FontColor;
Obj.style.backgroundColor = BackColor;
ObjState = obj;
}
}
-----------the mouse is double-clicked-----------
function Onfoucsdbclick (Obj,fontcolor,backcolor,openurl)
{
Parameter OpenURL is the address of the new window you want to open
if (Obj.rowindex > 0)
{
if (objstate!= null)
{
ObjState.style.color = "";
ObjState.style.backgroundColor = "";
}
Obj.style.color = FontColor;
Obj.style.backgroundColor = BackColor;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service