[英]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: 我正在使用这样的html图像按钮类型:
<input id="wbsupld" type="image" value="upload" onclick="showwbsdiv()" src="images/Upload.png">
and the javascript function is: 而javascript函数是:
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. 它显示一个div“ masswbsupld”,但问题是我的页面正在刷新,并且div返回到display =“ none”模式。
and i am using update panel .. is that causing this? 并且我正在使用更新面板..是引起这种情况的原因吗?
Because its type is image
, an image
input element will submit your form. 由于其类型为image
,因此image
input元素将提交您的表单。
You need to do 你需要做
onclick="return showwbsdiv();"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.