zoukankan      html  css  js  c++  java
  • 页面实现上传前预览

    <!DOCTYPE html>
    <%@ page language="java" pageEncoding="utf-8"%>
    <html>
    <head>
    <title>MyHtml.html</title>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK" />
    <script src="jquery.js" type="text/javascript"></script>
    </head>

    <body>
    <form action="./test" method="get" enctype ="multipart/form-data">
    <input type="text" name="name" value=""/><br/>
    <input type="file" id="path" name="file" />
    <fieldset style="80px;height:80px">
    <legend>预览</legend>
    <img id="imge" width="50px" height="50px" style="visibility:hidden" />
    </fieldset>
    <input type="submit" value="submit"/>
    </form>
    </body>
    <script type="text/javascript">
    $("#path").change(function(e){
    var reader = new FileReader();
    var file = this.files[0];
    reader.onloadstart = function (e) {};
    reader.onprogress = function (e) {};
    reader.onabort = function (e) {};
    reader.onerror = function (e) {};
    reader.onload = function (e) {
    $("#imge").attr("style","visibility:visible");
    $("#imge").attr("src", e.target.result);
    };

    reader.readAsDataURL(file);
    });
    </script>
    </html>

  • 相关阅读:
    Golang的演化历程
    优秀的计算机编程类博客和文章
    NET Portability Analyzer
    NET SqlClient
    Razor模板引擎
    js资源
    依赖注入和控制器
    Vue.js 2.0 和 React、Augular
    过滤器
    Prism vs MvvmCross
  • 原文地址:https://www.cnblogs.com/wbjgogogo/p/5909866.html
Copyright © 2011-2022 走看看