Saturday, 25 February 2017

Dynamic Array Java Script


Dynamic Array Java script

Enter Name :



Source Code

<!DOCTYPE> 
<html>

<head>

<title>Girfa : Student Help</title>
<script>
     var arr=[];
     function add()
     {         
           arr.push(data.value);
           data.value="";
           data.focus();
     }
     function show()
     {
           for(i=0;i<arr.length;i++)
                s1.innerHTML+="," + arr[i];
     }
</script>
</head> 
<body>
Enter Name : <input type="text" id="data" />
<input type="button" value="Add" onclick="add()" />
<input type="button" value="Show" onclick="show()" /><br /><br />
<span id="s1"></span> 
</body>
</html>