<form name='form1' id='form1' action='/xbcw/cw/xx_xx.action' method='post'> <input type="button" id="btnSubmit" name="btnSubmit" value="保存" onclick="addKp()" class="Button2" /> <input type="button" id="btnSubmit" name="btnSubmit" value="下一步" onclick="doAddCwKpSubmit()" class="Button2" /> </form>
當我點擊保存提交FORM表單后,如何讓當前頁面維持不變(即不刷新當前頁)?
在FORM表單后添加一個iframe
<iframe id="rfFrame" name="rfFrame" src="about:blank" style="display:none;"></iframe>
點保存提交事件里面需要將target改為iframe的名字:
JS:document.forms[0].target="rfFrame";
JQuery:$("#f2").attr("target","rfFrame");
這樣即提交了FORM保存了數據,頁面也不會跳轉.
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com