如果没有JS警报,则在加载时在ASP.NET中更改光标无法正常工作 [英] Changing the cursor in ASP.NET while loading doesn't work without a JS alert
本文介绍了如果没有JS警报,则在加载时在ASP.NET中更改光标无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在asp.net应用程序中将光标更改为沙漏,以使用户知道该进程正在运行。我搜索了一个答案,并建议使用JavaScript如下:
I want to change the cursor to an hourglass in my asp.net application to let my users know that the process is running. I searched for an answer and was advised to use JavaScript as follows:
-
添加此JavaScript:
Add this JavaScript:
function hourglass() {
document.body.style.cursor = "wait";
}
然后在页面加载事件中的代码中:
then in my code in the page load event:
btnImport.Attributes.Add("onclick", "javascript: hourglass();");
其中btnImport是他们单击的按钮。
Where btnImport is the button they click on.
但是,这不起作用。如果我向沙漏功能添加警报。它确实有效。
However this does not work. If I add an alert to the hourglass function. it does work. Is there some way to get this to work without the alert?
推荐答案
如何解决?
btnImport.Attributes.Add("onclick", "hourglass();");
这篇关于如果没有JS警报,则在加载时在ASP.NET中更改光标无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文