無標題頁標題>
腳本>
(函數($){
$.fn.extend({
insertAtCaret: 函數 (myValue) {
var $t = $(this)[0];
if (文件.選擇) {
this.focus();
sel = document.selection.createRange();
sel.text = myValue;
this.focus();
} 其他
if ($t.selectionStart || $t.selectionStart == '0')
{
var startPos = $t.selectionStart;
var endPos = $t.selectionEnd;
varscrollTop = $t.scrollTop;
$t.value = $t.value.substring(0, startPos) my p.
this.focus();
$t.selectionStart = startPos myValue.length;
$t.selectionEnd = startPos myValue.length
$t.selectionEnd = startPos myValue.length
;
$t.scrollTop = 且滾動上方;
} 其他 {
this.value = myValue;
this.focus();
}
}
})
})(jQuery);
$(文檔).ready(function () {
$("#numd").bind("mouseleave", function () {
document.getElementById('keybored').style.display = 'none';
document.getElementById('Nm').blur();
});
$("#Nm").focus(function () {
document.getElementById('keybored').style.display = '';
});
$(".readbtns").click(function () {
$("#Nm").insertAtCaret($(this).val());
});
});
> 腳本
頭>
/>
id="keybored">