程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> JSP編程 >> 關於JSP >> jsp 文件上傳浏覽,支持ie6,ie7,ie8

jsp 文件上傳浏覽,支持ie6,ie7,ie8

編輯:關於JSP

找了好久終於找到一個jsp上能用的…… 分享!!
復制代碼 代碼如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" href="../css/common.css" href="css/common.css" type="text/css" />
        <title>管理區域</title>
        <style type="text/css"><!--
#newPreview
{
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
--></style>
<script type="text/javascript" language="javascript"><!--
var flag=true;
function PreviewImg(imgFile)
{
//新的預覽代碼,支持 IE6、IE7,IE8也支持,firefox不支持!!我測試了的……
var newPreview = document.getElementById("newPreview");
newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
if(flag)
{
newPreview.style.width = "100px";
newPreview.style.height = "80px";
}
}
function setImgWH()
{
var newPreview = document.getElementById("newPreview");
flag=false;
newPreview.style.width = document.getElementById("txtImgWidth").value;;
newPreview.style.height = document.getElementById("txtImgHeight").value;
}
// --></script>
    </head>
    <body>
        <div id="man_zone">
        <form action="product.do?command=addProduct" method="post" name="Upload" enctype="multipart/form-data">
                <table width="100%" border="0" align="center" cellpadding="3"
                    cellspacing="1" class="table_style">

                    <tr>
                        <td class="left_title_2">
                            商品圖片:
                        </td>
                        <td><input type="file" name="file" onchange="javascript:PreviewImg(this);" style="border: 1px #FFFFFF
solid;background:#efefef" style="border: 1px #FFFFFF
solid;background:#efefef" /><font color=red>*</font><div id="newPreview"></div></td>
                    </tr>
                    <tr>
                        <td class="left_title_1">
                            <input type="submit" name="Submit" value="增加" />
                        </td>
                        <td>
                            <input type="reset" name="Reset" value="重置" />
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </body>
</html>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved