我需要將數據表單#send_form提交到另一個頁面中的#f_from的幫助。將表格提交到其他頁面
<script type="text/javascript">
function post_form() {
$('#send_form').action = "form01.html";
$('#send_form').submit();
return false;
}
</script>
<form id='send_form' action='form01.html' method='POST' onsubmit="post_form();">
<input type="text" name="f_in01" value="User" />
<input type="text" name="f_in02" value="12345" />
<input type="submit" />
</form>
的form01.html
<script type="text/javascript">
function f_res()
{
var res01=document.f_form.f_in01.value;
var res02=document.f_form.f_in02.value;
var result = res01 + " " + res02;
document.f_form.f_out01.value=result;
}
</script>
<form id="f_form" onSubmit="f_res();return false;">
<input type="text" name="f_in01" /><br>
<input type="text" name="f_in02" /><br>
<br>
<input type="submit" onClick="f_res();" value="Enter w/Sub" /><br>
<input type="text" name="f_out01" />
</form>
現在這是行不通的。該數據不page01.html發佈
這讓很少的感覺。請添加更多的細節和澄清。 – sachleen
嗯,你知道如果你打算向URL「form01.html」發出一個POST請求,你的HTTP服務器需要以某種方式處理?你不能只提供一個靜態文件「form01.html」,並期望它神奇地知道什麼形式的數據提出請求。您是否期望數據以某種方式呈現在form01.html的元素中,僅僅因爲它們具有相同的名稱屬性?這不是HTTP/HTML的工作原理。 –