One JavaScript instance every day-processing each line of characters in textarea, javascripttextarea
<! Doctype html>
How to use javascript to save the textarea value to an array by row
For example, if the ID of textarea is test_textarea js, it can be written as follows:
Var textarea = document. getElementById ("test_textarea ");
Var value = textarea. value;
Var text_array = value. split ("\ n ");
In text_array, each row is an array of values.
How to Implement javascript to display only 72 characters in one line, more than 72 characters in addition to one line
Here is 7. Change it to the number you want ~
<Html>
<Head>
<Title> </title>
</Head>
<Body>
<Div id = "hi"> when I go to school late in spring, I don't need to worry about it. When the wind falls into the dark red green leaves, the branches are full. </div>
<Script type = "text/javascript">
Var $ = function (ID) {return document. getElementById (ID );};
Var length = 7;
Var arr = [];
For (var I = 0; I <= $ ("hi"). innerText. length/7; I ++ ){
Arr. push ($ ("hi"). innerText. substring (I * length, (I + 1) * length ));
}
$ ("Hi"). innerHTML = arr. join ("<br/> ")
</Script>
</Body>
</Html>