<html>
<head>
<title>检测对象是否为原始对象</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>
</div>
<script type="text/javascript">
$(function () {
var obj = "null";
var strTmp = "您定义了一个:";
if (?) { //检测是否为原始对象
strTmp += "原始对象";
}
else {
strTmp += "非原始对象";
}
$(".content").html(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;
}
.fl
{
float: left;
}
.fr
{
float: right;
}