Javascript-Split the whole string into substring.


 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

 

<html>

<head>

<title>Sample Code</title>

<script type="text/javascript">

function SplitMyString(strOriginal,strDelimiter)

{

         var strArray=strOriginal.split(strDelimiter);

         var i;

         for(i=0;i<strArray.length;i++)

         {

                alert(strArray[i]);

         }

}

</script>

</head>

<body bgcolor=#00ff00 alink=blue vlink=blue>

<FORM name="windowEvent">

          Enter String : <input type="text" name="txtOriginal" /><br>

         Give Delimiter : <input type="text" name="txtDelimiter" /><br>

         <input type="button" value="Check" name="btnNumber" onClick="SplitMyString(txtOriginal.value,txtDelimiter.value);" />

</FORM>

</body>

</html>


Ebook Download
View all
Learn
View all