Monday, January 10, 2011
GridView Row Highlighting on Mouseover
void spgv_RowCreated(object sender, GridViewRowEventArgs e)
{
// only apply changes if its DataRow
if (e.Row.RowType == DataControlRowType.DataRow)
{
// when mouse is over the row, save original color to new attribute, and change it to highlight yellow color
e.Row.Attributes.Add("onmouseover",
"this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#EEEEEE';this.style.cursor='pointer'");
// when mouse leaves the row, change the bg color to its original value
e.Row.Attributes.Add("onmouseout",
"this.style.backgroundColor=this.originalstyle;this.style.cursor='default'");
// on click row, go to item detail
e.Row.Attributes.Add("onclick", "javascript:location.href='" + ((DataRowView)e.Row.DataItem).Row.ItemArray.GetValue(6) + "'");
}
}
Wednesday, December 9, 2009
Sliding Javascript Menu (onmouseover)
Code is a modification of the one found in http://www.leigeber.com/2008/04/sliding-javascript-dropdown-menu/
(Demo)
<!DOCTYPE .dropdown |
Friday, April 10, 2009
OnMouseOver Event: Show Text
Context: You have a text link and when the mouse pointer is over that link, there is a pop-up by the side that shows description of the link.
The idea is that each link has a Javascript mouseover event, which is defined to set the visibility of a division (div) to true. This is a very neat trick using CSS. Codes from this post are obtained from TechnoRealm. You can find more free Javascripts there!
1) Javascript function
<script language="Javascript"> |
|
|
|