我写了个代码,不知道能不能达到你的要求
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script>
function load() {
var j = [
{name: 'gupiao175', age: 24},
{name: 'foktime', age: 29},
{name: 'qingshuiliu', age: 23},
{name: 'gameohyes', age: 22}
];
var html = [];
for (var i=0; i<j.length; i++) {
html.push('name:' + j[i].name + ' | age:' + j[i].age + '<br>');
};
return html.join('');
}
function transfer(fn){
document.getElementById('div1').innerHTML = fn;
}
function read(){
transfer(load());
}
</script>
</head>
<body onload="read();">
<div id="div1"></div>
</body>
</html>