<html>
<head>
<title>选中文字自动加入到文本框 站长学院www.pigzz.com</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var text = "";
function getActiveText(e)
{
text = (document.all) ? document.selection.createRange().text : document.getSelection();
document.theform.text.value = text;
return true;
}
document.onmouseup = getActiveText;
if (!document.all)
document.captureEvents(Event.MOUSEUP);
</script>
<body>
<center>
欢迎你来到站长学院www.pigzz.com,欢迎多提宝贵建议。
<form name=theform>
选中的文本:<input type=text name=text value="">
</form>
</center>
</body>
</html>
运行效果: