0
我有一個表格:鉻_blank形式和JQuery雙提交
<form accept-charset="UTF-8" action="/back/pages/22?locale=fr" class="form-horizontal page-form" enctype="multipart/form-data" id="edit_page_22" method="post" target="_blank"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓">
<p><a href="#" id="no_window">Submit</a></p>
<p><a href="#" id="new_window">Submit & _blank</a></p>
</form>
而且腳本附:
$(document).ready(function() {
var page_form;
page_form = {
elem: $('form.page-form'),
rand_action: function() {
var action;
action = this.elem.attr('action');
return this.elem.attr('action', action + '&count=' + Math.random() * 1000);
},
submit_blank: function() {
this.elem.attr('target', '_blank');
$('<input>').attr({
type: 'hidden',
id: 'input_new_window',
name: 'edit_redirect',
value: 'true'
}).appendTo(this.elem);
return this.elem.submit();
},
submit: function() {
this.elem.attr('target', '_self');
$('#input_new_window').remove();
return this.elem.submit();
}
};
$("#new_window").click(function(event) {
event.preventDefault();
page_form.submit_blank();
page_form.rand_action();
return page_form.submit();
});
$("#no_window").click(function(event) {
event.preventDefault();
return page_form.submit();
});
});
它在FF,但無法在Chrome很好地工作,任何想法,爲什麼?
這不是我想要做的事情:我想在新選項卡中打開窗體的目標並用窗體更改頁面的位置。這是我的代碼在FF上實際執行的操作,而不是在Chrome上執行。 – Awea