<body>
<textarea id= "ttaOne " rows= "5 " cols= "30 "> </textarea>
<textarea id= "ttaTwo " rows= "5 " cols= "30 "> </textarea>
<script language= "JavaScript ">
<!--
var eOne = document.getElementById( "ttaOne ");
var eTwo = document.getElementById( "ttaTwo ");
var strContent = "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15 "
eOne.value = strContent;
eTwo.value = strContent;
eOne.onscroll = function() {
eTwo.scrollTop = eOne.scrollTop;
};
eOne.onkeypress = function() {
if (event.keyCode == 13)
{
eTwo.value += "\n ";
}
};
//-->
</script>
</body>
这样是实现一个textarea 回车放行时另一个textarea 也跟着回车放行
我还想问的是怎么让textarea 一个用了BackSpace键往前走怎么也让另一个也跟着用backspace键推着往前走?
谢谢
------解决方案--------------------
晕,LZ 之前的两贴还没结,怎么又问上了~~~
http://community.csdn.net/Expert/topic/5493/5493893.xml?temp=.1897547
http://community.csdn.net/Expert/topic/5494/5494294.xml?temp=.7225
俗话说“举一反三”,可是 LZ 却“接二连三”
这回要考虑考虑是否继续回答了?!!