1、設(shè)計(jì)源碼
代碼如下:
<!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>form提交表單頁面不跳轉(zhuǎn)</title>
</head>
<body>
<form action= id= method=post target=id_iframe>
<input type=text id=input_text name=input_text/>
<input type=submit id=sobmit name=submit value=提交 />
</form>
<iframe id=id_iframe name=id_iframe style=display:none;></iframe>
</body>
</html>
2、運(yùn)行結(jié)果
(1)輸入“451”,單擊“提交”
(2)輸入“45464646”,單擊“提交”
頁面提交刷新,不跳轉(zhuǎn)