简体   繁体   中英

Why on click of a input button using JavaScript i am getting my asp.net page refreshed?

I am using an html image button type like this:

<input id="wbsupld" type="image" value="upload" onclick="showwbsdiv()" src="images/Upload.png">

and the javascript function is:

 function showwbsdiv() {
        document.getElementById("masswbsupld").style.display = "block";
        return false;
    }

which is displaying a div "masswbsupld" but the problem is my page is getting refreshed and the div goes back to display="none" mode.

and i am using update panel .. is that causing this?

Because its type is image , an image input element will submit your form.

You need to do

onclick="return showwbsdiv();"

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