zoukankan      html  css  js  c++  java
  • 上传图片前浏览图片

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
      <title> New Document </title>
      <meta name="Generator" content="EditPlus">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <script type="text/javascript">
    
      </script>
     </head>
    
     <body>
      <form name="form4" id="form4" method="post" action="#"> 
    	  <input type="file" name="file4" id="file4"  onchange="preview4()" />
    	  <img id="pic4" src="" alt="图片在此显示" width="120"/>
      </form>
      <script type="text/javascript">
      function preview4(){     
    	  var x = document.getElementById("file4");     
    	  var y = document.getElementById("pic4");     
    	  if(!x || !x.value || !y)            return;      
    	  var patn = /.jpg$|.jpeg$|.gif$/i;     
    	  if(patn.test(x.value)){              
    	  y.src = "file://localhost/" + x.value; 
      }else{  
    	alert("您选择的似乎不是图像文件。"); 
      }
      }
      </script>
     </body>
    </html>
    
  • 相关阅读:
    网口
    uart
    wwww
    ddr相关的配置经验
    嵌入式的指令集和寄存器
    协议栈
    《贝贝GO》服务条款
    《贝贝GO》隐私政策
    《贝贝GO》技术支持
    《王牌助理》隐私政策
  • 原文地址:https://www.cnblogs.com/zhangshiwen/p/3847403.html
Copyright © 2011-2022 走看看