文件上传时如何显示状态消息? [英] How can I display a status message while a file is uploading?

查看:81
本文介绍了文件上传时如何显示状态消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以提供一种简单的方法来使用JavaScript在文件上传时显示状态消息并在文件上传时淡出吗?

Can any one give a simple method using JavaScript to display a status message while file is uploading and fade away when file is uploaded?

推荐答案

  <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>

这篇关于文件上传时如何显示状态消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆