找遍资料得出结果:不能
不过同时也找到了解决办法,就是用iframe的方式来提交表单,即实现无刷新提交表单又可以上传文件!
一、html代码
<!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" />
<title>无刷新提交表单</title>
<script type="text/javascript">
<!--
function callback(str){
alert(str);
}
// --></script>
</head>
<body>
<form name="form1" method="post" action="../post.php" target="post_frame" enctype="multipart/form-data">
<iframe name='post_frame' id="post_frame" style="display:none;" mce_style="display:none;"></iframe>
<input type="file" name="img" />
<input name="power[]" type="text"/>
<input type="submit" value="完成以上修改" name="submit" />
</form>
</body>
</html>
二、php代码(处理代码)
这里的代码就想怎么写怎么写了,不过这个里执行完了刚才那个hmtl页面应该要有所表现,这时就要用到上个页面中的 function callback()了
echo ("<script type=\"text/javascript\">parent.callback('操作成功 ! ')</ script>");
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
7月15日笔试总结
测验项目:3C数码商城+简答题+选择题测验时间:3小时不足之处:简答题3道题留白,完全不懂,仍需复习,一道题简写...
[阅读全文]
-
-
-
-
-
原生AJAX
AJAXAJAX 是指一种创建交互式、快速动态网页应用的网页开发技术,无需重新加载整个网页的情况下,能够更新部...
[阅读全文]
-
-
网友评论