简体   繁体   中英

Open javascript popup on image button click

I'm trying to open popup window when i click on image button in asp.net website, but when i click on image button the pop up window shows up for like one seconds and then disappears.when i use tag, it shows the pop up window, but when i try with the other way, it disappears. Am i missing something in the code.

 <div id="cover"></div>
 <div id="dialog">
My Dialog Content
<br><input type="text">
<br><input type="button" value="Submit">
<br><a href="#" onclick="closePopUp('dialog');">[Close]</a>
</div>
<a href="#" onclick="showPopUp('dialog');">Show</a>
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/slika/PLUS.gif" onClientClick="showPopUp('dialog');"  />

Clicking on ImageButton causes postback - that reloads the page with no popup shown. This link describes a way to have an ImageButton that does not cause form submision : Can I create an ASP.NET ImageButton that doesn't postback?

onClientClick="showPopUp('dialog');return false;"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM