gaufeo 发表于 2007-4-27 11:58:38

***综合类***神奇的文本框 在网页中选中任何字符都会在该文本框中

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
要完成此效果需要两个步骤

第一步:把如下代码加入到<head>区域中

<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);
//end -->
</script>


第二步:把如下代码加入到<body>区域中

<center>
<form name=theform>
被选中的文本:<input type=text name=text value="">
</form>
</center>
      










--------------------------------------

http://www.huoyue.com.cn 活跃网,活跃人群的论坛,访问活跃网,将给您带来意想不到的收获,还可以免费为您开论坛,让您免费拥有与朋友、网友交流的论坛。你是年轻人吗?你活跃你就上!
页: [1]
查看完整版本: ***综合类***神奇的文本框 在网页中选中任何字符都会在该文本框中