Home > Web Front-end > JS Tutorial > JavaScript code to position the cursor on a certain line of textarea_form effects

JavaScript code to position the cursor on a certain line of textarea_form effects

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 19:14:55
Original
1171 people have browsed it

   
  aaaaaaaaaaaaaa   

  cccccccccc   
  dddddddddddd   
  fffffffffffff   
     
     
     
  <script>    <br>  function   goL(Line)    <br>  {    <br>  ta1.focus();    <br>  var   v=ta1.value.split('n');    <br>  ch=0;    <br>  for(var   i=0;i<Line-1;i )    <BR>    ch =v[i].length;    <BR>  var   o=ta1.createTextRange();    <BR>  o.move("character",ch);    <BR>  o.select();    <BR>  }    <BR>  </script>


[Ctrl A 全选 注:如需引入外部Js需刷新才能执行
]<script> function goL(Line) { ta1.focus(); var v=ta1.value.split('\n'); ch=0; for(var i=0;i<Line-1;i++) ch+=v[i].length; var o=ta1.createTextRange(); o.move("character",ch); o.select(); } </script>
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template