JavaScript如何把整篇文章里的空格替换成换行符, 或把每一个句子分离成独立一行?? function sa(){s1.value=c.value.replace(/\s+/g, "\n");}function sb(){s2.value=c.value.replace(/([^\w+ ])/g, "$1\n");} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!doctype html><html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><body><div><textarea id="c" cols="67" rows="12">You are stupid! Come here. I will tell you the truth. Where you now?</textarea></div><div><textarea id="s1" cols="67" rows="12" readonly="readonly" ondblclick="sa()"></textarea></div><div><textarea id="s2" cols="67" rows="12" readonly="readonly" ondblclick="sb()"></textarea></div><script type="text/javascript">function sa(){ document.getElementById("s1").value=document.getElementById("c").value.replace(/(\w+|\W+)\s*/g,"$1\n");}function sb(){ document.getElementById("s2").value=document.getElementById("c").value.replace(/(.+?[\.\?!;])\s+/g,"$1\n");}</script></body></html> EXT树异步加载树节点过多问题 紧急求救!SOS JS问题,请帮忙,很急 事件当前鼠标位置 一个棘手的问题: 怎么能隐藏文本框? 在这段 JS 代码中 如何加如 onclick 条件 求关闭网站时打开新窗口的代码 正则表达式判断数字 和字母 hta 做ftp上传工具 求问关于E-R图的一些问题!!!!!!!!! $.getJson跨域请求成功却没返回值 结论文本框怎么得到值
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div><textarea id="c" cols="67" rows="12">You are stupid! Come here. I will tell you the truth. Where you now?</textarea></div><div><textarea id="s1" cols="67" rows="12" readonly="readonly" ondblclick="sa()"></textarea></div>
<div><textarea id="s2" cols="67" rows="12" readonly="readonly" ondblclick="sb()"></textarea></div>
<script type="text/javascript">
function sa(){
document.getElementById("s1").value=document.getElementById("c").value.replace(/(\w+|\W+)\s*/g,"$1\n");
}
function sb(){
document.getElementById("s2").value=document.getElementById("c").value.replace(/(.+?[\.\?!;])\s+/g,"$1\n");
}
</script>
</body>
</html>