Opt In (Do Not Edit Here)

Nov 2, 2016

Creation of Array object in javascript using JSON



<html>
<head>
<title>Creation of array object in javascript using JSON</title>
<style>
body {text-align:center;}
table ,td {border:1px solid black;padding:5px;}
table {width:400px;}
</style>
<script language="javascript" >
document.writeln("<h2>JSON Array Object</h2>");

var employees = {
         "accounts":[{"Name":"Mayur Dighe", "Salary":27000},
         {"Name":"Nikita Bansode", "Salary":27000},
         {"Name":"Aditya Chalke", "Salary":28000}],

         "sales":[{"Name":"Satyajit Deshmukh", "Salary":29000},
         {"Name":"Sharvari Patil", "Salary":31000},
         {"Name":"Saurabh D.", "Salary":32000}],

         "production":[{"Name":"Namarta Kamble", "Salary":30000},
         {"Name":"Arshad Shaikh", "Salary":30000}]
}


document.write("<h3>Accounts</h3>");

document.write("<table align=center>");
for(i=0;  i<employees.accounts.length; i++){
     document.write("<tr><td>"+employees.accounts[i].Name+"</td>");
     document.write("<td>"+employees.accounts[i].Salary+"</td></tr>");
}
document.write("</table>");

document.write("<h3>Sales</h3>");

document.write("<table align=center>");
for(i=0;  i<employees.sales.length; i++){
     document.write("<tr><td>"+employees.sales[i].Name+"</td>");
     document.write("<td>"+employees.sales[i].Salary+"</td></tr>");
}
document.write("</table>");


document.write("<h3>Production</h3>");

document.write("<table align=center>");
for(i=0;  i<employees.production.length; i++){
     document.write("<tr><td>"+employees.production[i].Name+"</td>");
     document.write("<td>"+employees.production[i].Salary+"</td></tr>");
}
document.write("</table>");

</script>
</head>
</html>

Nov 1, 2016

Creating Simple JSON Object with JavaScript



<html>
<head>
<title>Creating Simple JSON Object with JavaScript</title>

<style>
body {padding:80px; text-align:center;}
</style>

<script language="javascript" >

 var JSONObj1 = { "movie":"Chennai Express", "year":2013 };

 var JSONObj2 = { "movie":"Singham Returns", "year":2014 };


  document.write("<h1>Simple JSON Object</h1>");

  document.write("<h3>-----Movies-----</h3>");

  document.write("Movie-1 : "+JSONObj1.movie);
  document.write("<br>Release Year: "+JSONObj1.year);
  document.write("<br>");

  document.write("<br>Movie-2 : "+JSONObj2.movie);
  document.write("<br>Release Year: "+JSONObj2.year);
  document.write("<br>");

</script>
</head>
</html>

simple json object in javascript

All Rights Reserved. 2014 Copyright SIMPLITONA

Powered By Blogger | Published By Gooyaabi Templates Designed By : BloggerMotion

Top