• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

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,
0
Weller0123
Asked:
Weller0123
  • 2
  • 2
1 Solution
 
salasksCommented:
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.
0
 
salasksCommented:
sorry, that should be:

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

where you use the button:
<asp:imagebutton runat="server"  ImageUrl="..images/Look.gif" id="btnLOV"/>
0
 
Weller0123Author Commented:
This gets the onclick event to fire but still posts back...

I think I can do an html image onclick...
0
 
Weller0123Author Commented:
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();">
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now