<div contenteditable="true" id="guestbook_editor">2</div>
<button onclick="set_focus()">aa</button>
function set_focus()
{
var el=document.getElementById('guestbook_editor');
var range = document.createRange();
range.selectNodeContents(el);
range.collapse(false);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
网友评论