【问题标题】:How can I display a status message while a file is uploading?如何在文件上传时显示状态消息?
【发布时间】:2009-05-05 04:59:07
【问题描述】:

谁能给出一个简单的方法,使用 JavaScript 在文件上传时显示状态消息并在文件上传时消失?

【问题讨论】:

  • window.status = "上传中...";

标签: javascript jsp


【解决方案1】:
  <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>

【讨论】:

    【解决方案2】:

    使用 Jquery 插件,您可以应用许多 上传时和之后的效果 已上传。

    查看此演示链接:
    http://valums.com/wp-content/uploads/ajax-upload/demo-prototype.htm
    http://www.uploadify.com/demo/

    Jquery 示例:
    http://valums.com/ajax-upload/

    【讨论】:

      【解决方案3】:

      不久前我在similar situation 中使用了出色的BlockUI 插件jQuery

      【讨论】:

        【解决方案4】:
          <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>
        

        【讨论】:

          【解决方案5】:

          这取决于您的服务器端语言。如果你使用 PHP,你需要这样的东西:Martin Jansen

          【讨论】:

            猜你喜欢
            • 2021-05-04
            • 2017-06-27
            • 2011-06-12
            • 2016-11-28
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2014-02-27
            相关资源
            最近更新 更多