87,997
社区成员




<SCRIPT LANGUAGE=javascript>
<!--
function alertselection(){
alert(document.selection.createRange().text)
}
//-->
</SCRIPT>
<INPUT id=text1
size=100 value="得到文本框选中的文字:自己用鼠标选中几个文字,然后就输出这几个文字,其他文字不输出来" onmouseup=alertselection()>
var oRange = document.selection.createRange(); // 取所选区域, oRange.text就是所选文字
var sRangeType = document.selection.type;
if(sRangeType == "Text"){
oRange.pasteHTML("<b>" + oRange.text + "</b>");
}
var context = document.getElementById("文本区域id").value;
document.write(context);