问题描述
<textareaname="T1"rows="10"></textarea><textareaname="T2"rows="10"></textarea><script>vart1=document.getElementById("T1");vart2=document.getElementById("T2");t1.onscroll=function(){t2.scrollTop=t1.scrollTop;}t2.onscroll=function(){t1.scrollTop=t2.scrollTop;}setInterval("s()",10);functions(){varlineT1=t1.value.split("r");varlineT2=t2.value.split("r");if(lineT1.length>lineT2.length){for(vari=1;i<=(lineT1.length-lineT2.length);i++){t2.value=t2.value+"rn";}}elseif(lineT2.length>lineT1.length){for(vari=1;i<=(lineT2.length-lineT1.length);i++){t1.value=t1.value+"rn";}}}</script>我想用这个方法实现T1,T2两边行数相同!但是不知道是哪里出错了...没有实现!请高手指点!
时间: 2024-12-01 14:17:06