form表單的target,當iframe設置爲隱藏時,能夠實現當前頁表單提交而部進行跳轉刷新,代碼以下:javascript
<form action="提交的action" method="post" target="myIframe">
.....................
</form>
<iframe name="myIframe" style="display:none"></iframe>java
提交到action後,action返回一串javascript語句post
js:orm
String script = "<script>alert('hello!');</script>";
response.getOutputStream().write(script.getBytes("utf-8"));ip
alert("hello")將在當前頁執行,原理是form提交後的結果在target指定的iframe裏執行,iframe已經隱藏了,這樣提交後的效果就和無刷新的效果同樣。utf-8