Groups | Blog | Home
all groups > asp.net > july 2004 >

asp.net : mouseover changing bordercolor



Bobby Ryzhy
7/8/2004 4:49:48 PM
use javascript an call a function like this:

function HighLight(obj)
{
var objs = document.all;
for (var i=0; i<objs.length; i++)
{
if (objs[i].className == 'hilite')
{
objs[i].className = 'nohilite';
}
}
obj.className = 'hilite';
}



[quoted text, click to view]


Bobby Ryzhy
bobby@ name of domain below
Ken Cox [Microsoft MVP]
7/8/2004 6:53:02 PM
Hi Eirik,

Same idea with a slightly different syntax:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
ImageButton1.Attributes.Add _
("onmouseover", "this.style.borderColor='Red';" & _
"this.src='http://www.gc.ca/images/englishbt.gif'")
End Sub

<asp:ImageButton id="ImageButton1" runat="server"
ImageUrl="http://www.gc.ca/images/francaisbt.gif"
BorderColor="Green" BorderWidth="3px"></asp:ImageButton>

Ken


[quoted text, click to view]
Eirik Eldorsen
7/8/2004 11:41:51 PM
Is it possible to make the mouseover event of a ImageButton to change the
border color?

I use this code to change the src:
ImageButton.Attributes.Add("onmouseover", "this.src='someImage.jpg'");



Eirik Eldorsen

AddThis Social Bookmark Button