开发者

help with form target, it popups in a blank page instead of the div I chose

I have set the target of the "pic_form" to a div (pic_target). The form (pic_form) and the div (pic_target) are both inside the same iframe (iframe_pic). Whatever I set the target to of the "pic_form", a new page pops up and there is my php script (imageUpload.php) output... WHY?

Here is my main page code:

        <form><iframe name="iframe_pic" src="iframe.html"></iframe></form>

Here is my iframe.html:

    <script type="text/javascript">
function reset_imageform(){
    f = document.getElementById("pic_form");
    f.src=f.src;
}
</script>
</head>
<body><form target="pic_target" name="pic_form" id="pic_form" enctype="multipart/form-data" method="post" action="bincgi/imageUpload.php"><input name="pic_file" type="file" id="pic_file" size="35" onChange="this.form.submit();"></form><div id="pic_target" name="pic_target"></div>

and here is some of my php file imageUpload.php:

    $display_image="<img src='../temp_images/$newfilename'>";
$display_image.="<br><a style='font-weight:bold; font-size:12px;' href='#' onclick='window.parent.reset_imageform();'>remo开发者_开发知识库ve picture</a>";
echo $display_image;

Thanks

IF you need more of the PHP file, just tell me...


yeah you can't target forms to divs, only to frames and iframes, so you the only thing you can do is put an iframe into that div with name pic_target

or that iframe can also be hidden and you can use JS to copy the contents from iframe to this div, you just can't point form to a div


Ignore my comment above. The only thing you should have to do is set the iframe target to iframe_pic.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜