• 上传图片时JS自动显示图片


    Code
    <HTML>
    <META http-equiv=Content-Type content="text/html; charset=utf-8">
    <HEAD>
    <TITLE> Test Page </TITLE>

    </HEAD>

    <BODY>
    <script>
    function preview(imgFile,num)
    {
        
    //预览代码,支持 IE6、IE7。
        var newPreview = document.getElementById("preview1");
      
        
    var t ;
        
    if(document.all) //IE
        t = imgFile.value;
        
    else
        t 
    = imgFile.files[0].getAsDataURL(); //FF
        newPreview.style.backgroundImage = "url(" + t + ")";//imgFile.value;
        newPreview.style.width = "108px";
        newPreview.style.height 
    = "130px";
        newPreview.style.display 
    = "block";
    }

    </script>
    <input type="file" onchange='ShowImg(this)' />

    <div id="preview1" style="border:1px solid #FFCC00; 108px; height:130px;display:block" >

    </div>
    <script>function ShowImg(o)
    {  
    //var Browser_Agent=navigator.userAgent;
    //
    if(Browser_Agent.indexOf("Firefox")!=-1)
    //
    {
    //
    火狐使用
      //  document.getElementById("idImg").src=o.files[0].getAsDataURL();
      //  document.getElementById("idImg").style.display = "block";
      // }
    //
    else
    //
    {
          preview(o,1);
        
    //}
    </script>


    </BODY>
    </HTML>

    aliyun活动 https://www.aliyun.com/acts/limit-buy?userCode=re2o7acl
  • 相关阅读:
    Classification and Representation(分类与表示)
    静态链表
    拓扑序列
    二分图问题
    大数据概述
    QT出现应用程序无法正常启动0xc000007b的错误
    简易有穷自动机实验
    一个简易的C语言文法
    词法分析器实验报告
    浅谈词法分析器
  • 原文地址:https://www.cnblogs.com/wangbin/p/1505663.html
Copyright © 2020-2023  润新知