⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imag.jsp

📁 整个系统采用MVC开发模式
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    

  </head>
  
  <body>
<form name="form5" id="form5" method="post" action="#">
 <input type="file" name="file5" id="file5" onchange="preview5()"/></form>
 <script type="text/javascript">
 function preview5(){
 var x = document.getElementById("file5");
 if(!x || !x.value) return;  
 var patn = /\.jpg$|\.jpeg$|\.gif$/i;  
 if(patn.test(x.value)){var y = document.getElementById("img5");    
 if(y){y.src = 'file://localhost/' + x.value;
 }
 else{var img=document.createElement('img');
 img.setAttribute('src','file://localhost/'+x.value);
 img.setAttribute('width','120');
 img.setAttribute('height','90');
 img.setAttribute('id','img5');
 document.getElementById('form5').appendChild(img);
 }
  }else{alert("您选择的似乎不是图像文件。");
  }
  }
  </script>
  </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -