Answers for "split textarea typescript"

0

split textarea typescript

<script language="javascript">
function split()
{
    var g1 = document.sp.g.value;
    var arr1 = new Array;
    if (g1.indexOf("\r\n") != -1)
    {arr1 = g1.split("\r\n");}
    else if (g1.indexOf("\n") != -1)
    {arr1 = g1.split("\n");}
    else if (g1.indexOf(",") != -1)
    {arr1 = g1.split(",");}
    else if (n.indexOf("\t") != -1)
    {arr1 = g1.split("\t");}
    else{arr1 = g1.split(" ");}
    for (var i=0; i<arr1.length; i++)
    {
        var line = i + 1;
        alert("Line " + line + " is: " + arr1[i]);
    }
}
</script>
<form name=sp>
<textarea style="width:400px; height:300px" name="g" cols="1" rows="10">
</textarea>
<input style="font-size: 17px" onclick="split()"
type="button" value="Test Code"/>
</form>
Posted by: Guest on April-04-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language