Client side button....

Posted on 2005-04-06
Last Modified: 2010-04-07
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)?

Question by:Weller0123
    LVL 1

    Expert Comment

    on page load:

    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.
    LVL 1

    Accepted Solution

    sorry, that should be:

    on page load:

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

    Author Comment

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

    I think I can do an html image onclick...

    Author Comment

    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();">

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now