-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
50 lines (47 loc) · 1.11 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>index</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var frame = $("#upl")[0];
var cd;
frameInit();
frame.onload = function(){
frameInit();
if($(cd).find("#path").length>0){
var path = $(cd).find("#path")[0].innerHTML;
if(/png|gif|jpg/g.test(path)){
$(".data").html("<img src='" + path + "'/><br />");
}else{
$(".data").html("<a href='" + path + "' target='_blank' >" + path + "</a><br />");
}
frame.src="upl";
}
}
$(".choose").click(function(){
$(cd).find("#data").click();
});
function frameInit(){
cd = frame.contentDocument.body;
var img = $(cd).find("#data")[0];
if(img){
img.onchange = function(){
$(cd).find("#sub").click();
}
}
}
})
</script>
</head>
<body>
您上传的东西为:<br /><br />
<div class="data">
无
</div><br />
<button class="choose">上传东西</button>
<iframe src="upload.html" frameborder="0" id="upl"></iframe>
</body>
</html>