【发布时间】:2012-11-27 12:54:45
【问题描述】:
我正在使用asp.Net 开发一个网站,它包含一个从iframe 调用的页面。
这个名为 Districting 的页面在 aspx 页面中有一个 javascript 代码。
我创建了一个函数,在单击“完成”按钮时执行。该函数测试用户提出的条件是否为真。
如果是,则加载另一个页面,如果不是,则会出现警报,但什么也没有发生。
但实际上,正在发生一些事情:页面正在刷新,这不是我想要的。
这是按钮:
<button id="Button1" onclick="testing()">Done</button>
这是功能测试:
function testing() {
if (conditions are true)
//Go to another page
else{
alert("Wrong decision");
//Stay in the current page without refreshing it
}
}
所以我只需要在点击“完成”按钮时阻止页面刷新。
提前致谢:)
【问题讨论】:
标签: javascript jquery asp.net