开发者

javascript code after form submission

I tested the following javascript code on a webpage.

<form method=POST id="someform" action="http://localhost/somepage.php" >
<input type=hidden name=stuff value="value">
</form>

<script>
document.forms['someform'].submit();
window.location="http://google.com";
</script>

The window successfully redire开发者_C百科cts to google after the form is submitted. I don't understand why. Isn't the control transfered to somepage.php? why is the window.location ... still executed.


Everything that is called is executed while the page doesn't disappear. The submit() call doesn't block the execution, it returns immediately.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜