0
我在DNN網站上向表單添加了一個recaptcha。我想使用asp.net Recaptcha控件,但它似乎不允許我輕鬆調整它的大小。'ScrollTop'爲空或不是對象
我決定去插入HTML到我的網頁在這裏的例子:
https://developers.google.com/recaptcha/docs/customization
我可以完美運行在Chrome和Firefox..but不是IE ..well至少不IE8我使用的版本,我得到一個JavaScript錯誤「ScrollTop」爲空或不是一個對象。該錯誤是在dnncore.js發生
的唯一參考scrollTop的是在以下的js功能
function __dnn_bodyscroll() {
var a = document.forms[0];
if (__dnn_ClientAPIEnabled() && __dnn_m_bPageLoaded) {
//prob seems to happen on next lineafter a.
a.ScrollTop.value = document.documentElement.scrollTop ? document.documentElement.scrollTop : dnn.dom.getByTagName("body")[0].scrollTop
}
}
function __dnn_setScrollTop(c) {
if (__dnn_ClientAPIEnabled()) {
if (c == null) {
c = document.forms[0].ScrollTop.value
}
var a = dnn.getVar("ScrollToControl");
if (a != null && a.length > 0) {
var b = dnn.dom.getById(a);
if (b != null) {
c = dnn.dom.positioning.elementTop(b);
dnn.setVar("ScrollToControl", "")
}
}
window.scrollTo(0, c)
}
}
是否有使用這種替代ScrollTop在IE中?
爲Recpatcha的HTML是
<script type="text/javascript">
var RecaptchaOptions = {
tabindex: 1,
theme: 'custom',
custom_theme_widget: 'recaptcha_widget'
};
function switchType(type) {
var input = document.getElementById('recaptcha_response_field');
if (type == 'audio') {
input.placeholder = "Type what you hear";
Recaptcha.switch_type('audio');
} else {
input.placeholder = "Type the text";
Recaptcha.switch_type('image');
}
}
</script>
<div id="recaptcha_widget" style="display: none">
<div id="recaptcha_image">
</div>
<div class="recaptcha_input left">
<div class="recaptcha_only_if_incorrect_sol" style="color: red;">
Incorrect, please try again</div>
<input type="text" id="recaptcha_response_field" name="recaptcha_response_field"
placeholder="Type the text" />
</div>
<div class="recaptcha_buttons left">
<a href="javascript:Recaptcha.reload()" title="Get a new challenge" id="recaptcha_reload_btn">
<img src="http://www.google.com/recaptcha/api/img/clean/refresh.png" id="recaptcha_reload"
alt="Get a new challenge" height="18" width="25"></a> <a href="javascript:switchType('audio');"
title="Get an audio challenge" id="recaptcha_switch_audio_btn" class="recaptcha_only_if_image">
<img src="http://www.google.com/recaptcha/api/img/clean/audio.png" id="recaptcha_switch_audio"
alt="Get an audio challenge" height="15" width="25"></a> <a href="javascript:switchType('visual')"
title="Get a visual challenge" id="recaptcha_switch_img_btn" class="recaptcha_only_if_audio">
<img src="http://www.google.com/recaptcha/api/img/clean/text.png" id="recaptcha_switch_img"
alt="Get a visual challenge" height="15" width="25"></a>
<a href="javascript:Recaptcha.showhelp()" title="Help" id="recaptcha_whatsthis_btn">
<img alt="Help" src="http://www.google.com/recaptcha/api/img/clean/help.png" id="recaptcha_whatsthis"
height="16" width="25"></a>
</div>
<img src="http://www.google.com/recaptcha/api/img/clean/logo.png" id="recaptcha_logo"
alt="" height="36" width="71">
<div class="clear">
</div>
</div>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=mycaptchakey">
</script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=mycaptchakey"
height="300" width="500" frameborder="0"></iframe>
<br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40" id="recaptcha_challenge_field" />
<input type="hidden" name="recaptcha_response_field" value="manual_challenge" />
</noscript>
有在頁面的源代碼沒有兩個標籤。我已經看到了造成這個原因的一些原因是因爲這個原因。
任何人都遇到過這個問題?
感謝,