can you add onMouseOver/onMouseOut to an ImageButton??

S

simon

hello. have an image button that i'd like to add some onMouseOver/Out
to an imageButton.

line looks like this...
<asp:ImageButton onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('go','','images/go_on.gif',1)"
ID="headerSearchButton" runat="server" Width="27" Height="20"
ImageUrl="http://localhost/App1/images/go_off.gif"></asp:ImageButton>

the onMouseOver/Out both have the squiggly lines under them in VS
(using 2003 by the way). which in some cases you can ignore when you
build the project and things sometimes work in the browser after the
compile. but in the case the mouse functions are not working.

is this possible, if so and this syntax is not correct, what would the
correct syntax be?

thanks
 
C

Cor Ligthert [MVP]

Simon,

In my opinon is th OnClick event disapeared from your button. Did you do
this direct in MacroMedia?

Cor
 
A

Andrew Morton

simon said:
hello. have an image button that i'd like to add some onMouseOver/Out
to an imageButton.

I think you want the .Attributes property, e.g. from the help:-
TextBox1.Attributes("onblur") = "javascript:alert('Hello! Focus lost from
text box!!');"

Andrew
 
S

simon

Hello Cor, i'm sorry, but i don't follow what you are saying? what i
was looking to do was onMouseOver/onMouseOut to an imagebutton. forced
those parm into the tag on the HTML side, but neither were
called/executed after compiling and running the project/app in the
browser. not sure what you are referring to about MacroMedia, this
was all written in VisualStudio 2003.
thanks for the reply, sorry i didn't get what you were asking...
 
S

simon

Andrew, thanks. i believe this is what i was looking for. will read
more about this today. thanks again!
 
C

Cor Ligthert [MVP]

Simon,
browser. not sure what you are referring to about MacroMedia, this
was all written in VisualStudio 2003.

Maybe but you have probably used (knowing or not knowing it), code from
(maybe changed however based on) MacroMedia, in Net you cannot set the
mouse-over on the client side with the developer. Beneath is a standard
image button description in Net, which has no standard property for
OnMouseOut or/and for OnmouseOver. (You can set it as is showed by Andrew,
although you have than still to add the JavaScript).

<asp:ImageButton id="ImageButton1" style="Z-INDEX: 101; LEFT: 448px;
POSITION: absolute; TOP: 136px" runat="server"></asp:ImageButton>

MacroMedia prefixes all its javascript methods with MM_ as is in your code
which I show you beneath again. With the method there has to be a piece of
JavaScript that process those codes.

<asp:ImageButton onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('go','','images/go_on.gif',1)"
ID="headerSearchButton" runat="server" Width="27" Height="20"
ImageUrl="http://localhost/App1/images/go_off.gif"></asp:ImageButton>

I don't see an On Click in it, by the Net code is it with all buttons done
with the runat="server" (for other controls do you have to force that). You
don't have that runat="server" in your code.

I hope this helps,

Cor
 
S

simon

I see what you are saying now. we hired a contractor to do some of
the graphical makeup to a site we are building, which included some
javascript references. so they must have used marcomedia to create
some of the javascript controls.
if i convert the images/buttons to .net objects, then i will add the
runat=server to them. thanks for the reminder!
that has been most of my issues latest is trying to get the html stubs
they provided back to us into the .net app we're building (that plus
i'm brand new to .net, so everything is a learning experience for me)
i appreciate all the replies and tips from all you guys
thanks again!
 

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

Top