日期:2014-05-16 浏览次数:20452 次
function showSelection(){ var o = document.forms[0].selectedText, r; if (window.getSelection) { o.value = o.value.substring(o.selectionStart, o.selectionEnd); } else { o.value = document.selection.createRange().text; } window.setTimeout(function () { o.focus(); o.select(); }, 0); } document.onmouseup = showSelection;
------解决方案--------------------
function showSelection(){
if(document.getSelection)
document.forms[0].selectedText.value=document.getSelection() ;
else
document.forms[0].selectedText.value=document.selection.createRange().text
}
//document.captureEvents(event.mouseUp)
document.onmouseup=showSelection ;