Display All Records, innerHTML
<html><head>
<title> Display All Records using innerHTML </title>
<script src="record.js"></script>
</head>
<body>
<script>
function renderHtml()
{
var jsonOutputDiv =
document.getElementById("theJsonOutput");
jsonOutputDiv.innerHTML = JSON.stringify(myRecord);
}
</script>
<button id="insertIt" onclick="renderHtml()">Insert to page
</button>
<div id="theJsonOutput"></div>
</body>
</html>
<title> Display All Records using innerHTML </title>
<script src="record.js"></script>
</head>
<body>
<script>
function renderHtml()
{
var jsonOutputDiv =
document.getElementById("theJsonOutput");
jsonOutputDiv.innerHTML = JSON.stringify(myRecord);
}
</script>
<button id="insertIt" onclick="renderHtml()">Insert to page
</button>
<div id="theJsonOutput"></div>
</body>
</html>
//save as record.js
var myRecord = [
{
name: "John",
height: "5 Feet 10 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: "John",
height: "5 Feet 10 Inches",
weight: 140,
eyeColor: "Brown",
nationality: "French, Irish "
},
{
name: "Donald",
height: "6 Feet 4 Inches",
weight: 160,
eyeColor: "Blue",
nationality: "Ukrainian, French"
}
];