我在一个DNN网站上的表单中添加了一个recaptcha。我想使用asp.net Recaptcha控件,但它似乎不允许我轻松地调整它的大小。
我决定将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)
}
}
除了在IE中使用这个ScrollTop之外,还有别的选择吗?
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>
页面源中没有两个标记。我看到了一些原因是因为这个原因。
有人遇到这个问题了吗?
谢谢,
发布于 2014-07-07 13:41:57
好的,我想我找到了原因,这是与textarea标签有关的。
我将"textarea“标签的结尾替换为"/textarea”
而且它似乎奏效了。#狂虫
https://stackoverflow.com/questions/24609277
复制相似问题