我有這個功能對於應對從窗口窗口工作的一種方式的價值觀,而不是另一個...Javascript和JQuery奇怪的問題或我做錯了什麼?
工作腳本:
$(document).ready(function(e) {
$('#clickit').live({
click: function() {
window.opener.document.forms['orderForm']['service'].value = document.forms['GroundRates']['service'].value;
window.opener.document.forms['orderForm']['rate'].value = document.forms['GroundRates']['rate'].value;
self.close();
return false;
}
});
});
現在我在這等劇本,我做了什麼錯誤?我在這裏拉我的頭髮。
不工作:
$(document).ready(function(e) {
$('#clickit').live({
click: function() {
var thisservice = document.forms['GroundRates']['service'].value;
var thisrate = document.forms['GroundRates']['rate'].value;
var thatservice = window.opener.document.forms['orderForm']['service'].value;
var thatrate = window.opener.document.forms['orderForm']['rate'].value;
$(thatrate) = $(thisrate);
$(thatservice) = $(thisservice);
self.close();
return false;
}
});
});
我也試過..
$(thatrate).val() = $(thisrate).val();
$(thatservice).val() = $(thisservice).val();
和..
thatrate = thisrate;
thatservice = thisservice;
但這個工程:
var service = document.forms['GroundRates']['service'].value;
var rate = document.forms['GroundRates']['rate'].value;
window.opener.document.forms['orderForm']['service'].value = service;
window.opener.document.forms['orderForm']['rate'].value = rate;
我是不是正確地爲window.opener
正確指定var?
僅供參考,語法是'$(thatrate).VAL($(thisrate).VAL())' – climbage