<!DOCTYPE html>
<html>
<head>
<title>使用$.extend()扩展Object对象</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="http://www.imooc.com/data/jquery-1.8.2.min.js" type="text/javascript"></script>
</head>
<body>
<div id="divtest">
<div class="title">
<span class="fl">合并原有对象</span>
</div>
<div class="content">
<div class="tip"></div>
</div>
</div>
<script type="text/javascript">
$(function () {
var objInfo = { name: "" };
var objMess = { name: "白富美,", title: "欢迎与我联系!" };
var objNewInfo =?;
var strTmp = "<b>对象 白富美 合并后</b>:<br/><br/>";
strTmp += objNewInfo.name + objInfo.title;
//显示在页面中
$(".tip").show().append(strTmp);
});
</script>
</body>
</html>
#divtest
{
width: 282px;
}
#divtest .title
{
padding: 8px;
background-color: Blue;
color: #fff;
height: 23px;
line-height: 23px;
font-size: 15px;
font-weight: bold;
}
#divtest .content
{
padding: 8px;
background-color: #fff;
font-size: 13px;
}
#divtest .content .tip
{
border: solid 1px #ccc;
background-color: #eee;
margin: 10px 0px;
padding: 8px;
display: none;
}
.fl
{
float: left;
}
.fr
{
float: right;
}