<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>
當(dāng)我點(diǎn)擊保存提交FORM表單后,如何讓當(dāng)前頁面維持不變(即不刷新當(dāng)前頁)?
在FORM表單后添加一個iframe
<iframe id="rfFrame" name="rfFrame" src="about:blank" style="display:none;"></iframe>
點(diǎn)保存提交事件里面需要將target改為iframe的名字:
JS:document.forms[0].target="rfFrame";
JQuery:$("#f2").attr("target","rfFrame");
這樣即提交了FORM保存了數(shù)據(jù),頁面也不會跳轉(zhuǎn).
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com