【发布时间】:2009-05-05 04:59:07
【问题描述】:
谁能给出一个简单的方法,使用 JavaScript 在文件上传时显示状态消息并在文件上传时消失?
【问题讨论】:
-
window.status = "上传中...";
标签: javascript jsp
谁能给出一个简单的方法,使用 JavaScript 在文件上传时显示状态消息并在文件上传时消失?
【问题讨论】:
标签: javascript jsp
<style type="text/css">
#loadingMessage {
position: absolute;
top: WHEREVER;
left: WHEREEVER;
z-Index: 100;
}
</style>
<div id="loadingMessage" style="visibility:hidden;">This page be uploading!</div>
<form id="yourForm"> ... </form>
<script>
document.getElementById("yourform").onsubmit = function() {
document.getElementById("loadingMessage").visibilty = "visible";
return true;
};
</script>
【讨论】:
使用 Jquery 插件,您可以应用许多 上传时和之后的效果 已上传。
查看此演示链接:
http://valums.com/wp-content/uploads/ajax-upload/demo-prototype.htm
http://www.uploadify.com/demo/
Jquery 示例:
http://valums.com/ajax-upload/
【讨论】:
不久前我在similar situation 中使用了出色的BlockUI 插件jQuery。
【讨论】:
<style type="text/css">
#loadingMessage {
position: absolute;
top: WHEREVER;
left: WHEREEVER;
z-Index: 100;
}
</style>
<div id="loadingMessage" style="visibility:hidden;">This page be uploading!</div>
<form id="yourForm"> ... </form>
<script>
document.getElementById("yourform").onsubmit = function() {
document.getElementById("loadingMessage").visibilty = "visible";
return true;
};
</script>
【讨论】:
这取决于您的服务器端语言。如果你使用 PHP,你需要这样的东西:Martin Jansen
【讨论】: