单个/多个
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Author" content=" ">
<title>Document</title>
<style type="text/css">
*{margin: 0;padding: 0;}
a{text-decoration: none;}
ul,li{list-style: none;}
body{font-size: 14px;font-family: "微软雅黑";}
</style>
</head>
<body>
<h1 id="hh"></h1>
<script type="text/javascript">
var person = {"name":"xq"};
var person1 = {"age":18};
function mixin(obj,obj1){
for(var k in obj1){
if(obj1.hasOwnProperty(k)){
obj[k] = obj1[k];
};
};
return obj;
};
function mixin1(target,source){
var args = [].slice.call(arguments);
if(args.length==1){
return target;
};
var i = 1;
while((source = args[i++])){
for(var k in source){
if(source.hasOwnProperty(k)){
target[k] = source[k];
};
};
};
return target;
};
var json = mixin(person,person1);
var json1 = mixin1(person,person1,{"address":"长沙"});
function loading(opts){
var defaults = {
title:"同学们晚上好"
};
var json = mixin1({},defaults,opts);
document.getElementById("hh").innerHTML = json.title;
};
loading({
title:"我爱你们,同学们"
});
</script>
</body>
</html>