display the inserted value in java - CodeTextPro | Web Tutorial | Technology

CodeTextPro.com Provides - Web design, Technology gyan, Digital marketing, Online earnings, Seo, Adsense, Technology news, Motivation and inspiration, Latest Technology Affairs, Gadgets, Blogging

Wednesday, January 9, 2019

display the inserted value in java

Array Program
<html>
<head>
<title> java tutorial...</title>
<style type="text/css">
#d1{
background-color: cyan;
color:black;
height:40%;
width:60%;
}
</style>
<script type="text/javascript">
var x=[];
function insert()
{

for(var i=0;i<3;i++)
{
      var y=[];
     for(var j=0;j<3;j++)
  {
  y.push(j);
  }
x.push(y);
}
}
function display(){
for(var i=0;i<3;i++)
{
   for(var j=0;j<3;j++){
document.getElementById("d1").innerHTML+= x[i][j]+" ";
}
document.getElementById("d1").innerHTML+="<br>";
              }
  
     
}
</script>
</head>
<body>
<input type="button" value="add element" onclick="insert()"/>
<input type="button" value="display" onclick="display()"/>
<div id="d1">

</div>
</body>
</html>



Output:











No comments:

Post a Comment