Link to home
Start Free TrialLog in
Avatar of Weller0123
Weller0123

asked on

Client side button....

When I changed the attributes for an input button from:

<input id="btnLOV" onclick="showLOV();" type="button" value="Lookup" name="btnLOV">

To: (to show an image instead of a button)

<input id="btnLOV" onclick="showLOV();" type="image" src="images/Look.gif" name="btnLOV">

The page is now posting back.

Is there anyway to use an image as a clientside button (that will not cause a postback)?

Thanks,
Avatar of salasks
salasks

on page load:
btnLOV.Attributes.Add("onclick","showLOV();")

where you use the button:
<asp:imagebutton runat="server"  ImageUrl="..images/Look.gif" id="LogOut0"/>

The server will generate the JavaScript dynamically when it sends the aspx page to the client.
ASKER CERTIFIED SOLUTION
Avatar of salasks
salasks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Weller0123

ASKER

This gets the onclick event to fire but still posts back...

I think I can do an html image onclick...
This works in IE...

I don't think it will work in other browsers.  I only need it for IE though...

<img src="images/Look.gif" id="btnLOV" onclick="showLOV();">