开发者

Form submit with javascript works in Google Chrome only once

I have simple form.

<form target="_blank" action="somescript.php" method="Post" id="simpleForm">
<input type="hidden" name="url" value="http://...">
<input type="hidden" name="code" value="wrxosf">
</form>

...and there are some anchor link

<a href="#" onclick="$('#si开发者_开发问答mpleForm').submit();return false;">Do it!</a>

It works fine in FireFox or IE, but Google Chrome. Chrome does once, then link become unclickable.


Also had such problem.

The decision was to add something random to URL each time before submitting.

HTML:

<form action="go.php" method="post" target="_blank" id="go">
...
</form>

JavaScript (jQuery):

$('#go').attr('action','go.php?'+Math.random()*1000).submit();


Forms with target="_blank" submiting only once. This is webkit & chromium bugs.


I am running Chrome 7.0.5 and also still having this problem. Setting the action to something different each time as suggested above works! :)


This problem was fixed in the latest version of Chrome 5.0.375.55

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜