1.如何使iframe里的信息,传到div那?
2.如果不使用iframe而使用div的话,怎么让div里的form进行提交且不跳转?
3.文件提交到服务器后,如何获取他的地址,并返回到input里?
<body>
<div>
<input type="text">
</div>
<iframe scr="./upload.php"></iframe>
</body>
upload.php:
<form action="xxx.php" method="post" enctype="multipart/form-data">
<input type="file" name="file" onchange="uploadImg()">
</form>
<script>
//上传图片
function uploadImg(){
$("form:first").trigger("submit")
}
</script>
之前在做chrome插件的时候,碰到过iframe与外部通讯,不知道有没有帮助
https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
https://github.com/xwartz/xwartz.github.com/issues/1