You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.5 KiB
43 lines
1.5 KiB
<span onmouseover="if(Dd('question').style.display=='none') reloadquestion();"><span id="question" style="display:none;"><span id="questionstr"></span> <a href="javascript:reloadquestion();">[换个问题]</a><br/></span>
|
|
<input name="answer" id="answer" type="text" size="30" class="input-question" placeholder="点击显示问题并填写答案"/><span id="canswer"></span>
|
|
</span>
|
|
<script type="text/javascript">
|
|
function reloadquestion() {
|
|
Dd('question').style.display = '';
|
|
Dd('canswer').innerHTML = '';
|
|
Dd('answer').value = '';
|
|
Dd('canswer').innerHTML = '';
|
|
$('#destoon_question').remove();
|
|
s = document.createElement("script");
|
|
s.type = "text/javascript";
|
|
s.id = "destoon_question";
|
|
s.src = "{DT_PATH}api/captcha.png.php?action=question&refresh="+Math.random()+".js";
|
|
document.body.appendChild(s);
|
|
}
|
|
function checkanswer(s) {
|
|
s = $.trim(s);
|
|
var t = encodeURIComponent(s);
|
|
if(t.indexOf('%E2%80%86') != -1) s = decodeURIComponent(t.replace(/%E2%80%86/g, ''));
|
|
if(s.length < 1) {
|
|
Dd('answer').focus; return;
|
|
}
|
|
$.post(AJPath, 'action=question&answer='+s,
|
|
function(data) {
|
|
if(data == '0') {
|
|
Dd('canswer').innerHTML = ' <img src="{DT_STATIC}file/image/check-ok.png" align="absmiddle"/>';
|
|
{if $DT_MOB == 'ios'}
|
|
Dd('answer').value = s;
|
|
{/if}
|
|
} else {
|
|
Dd('answer').focus;
|
|
Dd('canswer').innerHTML = ' <img src="{DT_STATIC}file/image/check-ko.png" align="absmiddle"/>';
|
|
}
|
|
}
|
|
);
|
|
}
|
|
$(function() {
|
|
$('#answer').bind('keyup blur', function() {
|
|
checkanswer($('#answer').val());
|
|
});
|
|
});
|
|
</script>
|