0
私はを続行しますボタンユーザーがクリックしたときに検証機能が呼び出され、ページにエラーがある場合は上に表示してスクロールしますwindow.scrollTo(0,0);
window.scrollToはiframeで使用されていないと動作しません
このページはiframe
にロードされ、window.scrollTo(0,0);
は機能しません。私はwindow.parent.scrollTo(0,0);
または$('#error_msg_smry').animate({ scrollTop: 0 }, 0);
のような考えられる方法を試しましたが、何も動作しません。以下は
(エラーメッセージは以下のDIV)私のコードです:
<div id="error_msg_smry" class="error_msg_summary" style="display:none;" >
<br/>
<div class="error_msg_heading">Sorry, but we cannot process your donation until the following errors have been fixed:</div>
<div> </div>
<div class="error_messages">
<div id="selDonationErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="otherAmtErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="lessDonationErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="recipientErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="firstNameErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="lastNameErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="emailErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="creditCardNameErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="creditCardNumberErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="creditCardExpiryMonthErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="creditCardExpiryYearErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
<div id="creditCardCCVErr" class="textClass" style="color:#b94a48; font-weight:400;"></div>
</div>
<br/>
</div>
下のボタン:
<apex:commandButton styleclass="btn" action="{!makeDonation}" onClick="return validate();" value="Continue"/>
そして、私の検証機能では、私は次のようにします。
if(isPass == false){
document.getElementById("error_msg_smry").style.display = 'block';
window.scrollTo(0,0);
}
親ページ(iframeの外側)にアクセスできません。
は、誰もが誰もが同じ問題に直面し、解決策を探しているなら、私は
この上の任意の更新をしてください。
を私はコードの下に書いて、それを解決? – shareef