我如何在我的代码中添加一个进度光标以通知用户在点击提交按钮或上传许多文件时的上传按钮时等待? 这是我的表格:
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="files[]" multiple="multiple" accept="*">
<input type="submit" value="Ανέβασμα Αρχείων">
</form>
<form action="execute.php" method="post" >
<input type="submit" value="Εκτέλεση ελέγχου">
</form>
最佳答案
将此属性添加到您的提交按钮:
onclick="function(){document.body.style.cursor='wait'}"
(显然在边缘,你必须添加 void
像 onclick="void function(){document.body...
)
所以它应该是这样的:
<input type="submit" value="Εκτέλεση ελέγχου" onclick="function(){document.body.style.cursor='wait'}">
现在,当你想重置光标时,使用这段代码:
document.body.style.cursor = 'default';
基本上,
document.body.style.cursor='wait' // loading cursor
使指针看起来像是正在加载,并且
document.body.style.cursor = 'default'; // normal cursor
重置它。
将这些与您的上传功能结合使用,这样您就可以让按钮 onclick 将其设置为等待光标,然后,当您的上传功能完成时,将其设置回去。
关于javascript - 单击提交按钮时如何放置进度光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27184353/