ここで何が問題なのか本当にわかりません。私が見る限り、コードは単純で、正常に機能するはずです。
var Prices="";
for (var PriceCount = 1; PriceCount <= 120; PriceCount++) {
var CurrentPrice = "Price" + PriceCount;
if (prevDoc.getElementById(CurrentPrice).value != null) {
if (Prices == "") {
Prices = prevDoc.getElementById(CurrentPrice).value;
} else {
Prices += "," + prevDoc.getElementById(CurrentPrice).value;
}
} else {
break;
}
}
フォームには最大120個の非表示の入力が存在する可能性があります。存在しない入力をチェックした瞬間に、ループが中断するはずです。私のテストページには、プルされる2つの入力要素があります。3番目(null)に、firebugで次のエラーが発生します。
prevDoc.getElementById(CurrentPrice) is null
if (prevDoc.getElementById(CurrentPrice).value != null) {
はい、それはnullです...それがಠ_ಠのチェックです</ p>
私が間違っていることを誰かが知っていますか?これは本当に簡単なはずです。
編集:わかりやすくするために、prevDoc = window.opener.document