//这里用ie测试 弹出 1、0 用 google 测试 弹出 1 、1 why ??
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>图片预览效果</title>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
</head>
<body>
<style>
.perview {width:600px;background:#fff;font-size:12px; border-collapse:collapse;}
.perview td, .perview th {padding:5px;border:1px solid #ccc;}
.perview th {background-color:#f0f0f0; height:20px;}
.perview a:link, .perview a:visited, .perview a:hover, .perview a:active {color:#00F;}
.perview table{ width:100%;border-collapse:collapse;}
</style>
<iframe name="QUICKUPLOAD_1" style="display: inline;"></iframe>
<table border="0" class="perview">
<tbody>
<tr>
<th>选择文件</th>
<th width="50%">预览图</th>
</tr>
<tr>
<td height="200">
<input id="idFile" name="pic" type="file" />
</td>
<td align="center"><img id="idImg" /></td>
</tr>
</tbody>
</table>
<script type="text/javascript">
(function($){
$("#idFile").bind("change",function(){
var iframe=$("iframe[name=QUICKUPLOAD_1]");
alert(iframe.length);
if($.browser.msie){
$("<form id=form></form>").appendTo(iframe);
}else{
$("<form id=form></form>").appendTo(iframe);
}
var form =$("#form");
alert(form.length);
});
})(jQuery);
        
</script>
</body>
</html>