for loop ALL Records,
Select Items, Spaces, New Line 2
<!doctype html>
<html>
<head>
<title> for loop ALL Records, Select Items, Spaces, New Line 2 </title>
<meta charset="UTF-8">
<script src="record.js"></script>
</head>
<body>
<script>
function renderHtml()
{
var jsonOutputDiv = document.getElementById("theJsonOutput");
var output = '';
for(var i = 0; i < myRecord.length; i++)
{
output += myRecord[i].name;
output += " ";
output += myRecord[i].height;
output += " ";
output += myRecord[i].weight;
output += '<br>';
}
jsonOutputDiv.innerHTML = output;
}
</script>
<button id="insertIt" onclick="renderHtml()">Insert to page</button>
<div id="theJsonOutput"></div>
</body>
</html>
<html>
<head>
<title> for loop ALL Records, Select Items, Spaces, New Line 2 </title>
<meta charset="UTF-8">
<script src="record.js"></script>
</head>
<body>
<script>
function renderHtml()
{
var jsonOutputDiv = document.getElementById("theJsonOutput");
var output = '';
for(var i = 0; i < myRecord.length; i++)
{
output += myRecord[i].name;
output += " ";
output += myRecord[i].height;
output += " ";
output += myRecord[i].weight;
output += '<br>';
}
jsonOutputDiv.innerHTML = output;
}
</script>
<button id="insertIt" onclick="renderHtml()">Insert to page</button>
<div id="theJsonOutput"></div>
</body>
</html>
//save as record.js
var myRecord = [
{
name: "Key",
height: "5 feet 9 3/4 inches",
weight: 140,
eyeColor: "Brown",
nationality: "French, Irish"
},
{
name: "Donald",
height: "6 feet 4 inches",
weight: 160,
eyeColor: "Blue",
nationality: "Ukrainian, French"
}
];
var myRecord = [
{
name: "Key",
height: "5 feet 9 3/4 inches",
weight: 140,
eyeColor: "Brown",
nationality: "French, Irish"
},
{
name: "Donald",
height: "6 feet 4 inches",
weight: 160,
eyeColor: "Blue",
nationality: "Ukrainian, French"
}
];