mouseover changing bordercolor

E

Eirik Eldorsen

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
 
B

Bobby Ryzhy

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.className == 'hilite')
{
objs.className = 'nohilite';
}
}
obj.className = 'hilite';
}



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


Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net
 
K

Ken Cox [Microsoft MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top