找遍資料得出結果:不能
不過同時也找到了解決辦法,就是用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 method="POST" action="../post.php" target="post_frame" enctype="multipart/form-data">
<iframe mce_style="display:none;"></iframe>
<input type="file" />
<input type="text"/>
<input type="submit" value="完成以上修改" />
</form>
</body>
</html>
復制代碼 代碼如下:
echo ("<script type=/"text/javascript/">parent.callback('操作成功 ! ')</ script>");
新聞熱點
疑難解答
圖片精選