我的html文件
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>@ViewBag.Title</title>
<link href="../../bootstrap/css/bootstrap.css" rel="stylesheet" />
<link href="../../bootstrap/css/bootstrap-responsive.css" rel="stylesheet" />
<script src="../../scripts/jquery-1.7.1.min.js"></script>
<script src="../../bootstrap/js/bootstrap.js"></script>
<script src="../../bootstrap/js/bootstrap-collapse.js"></script>
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<img class="brand" src="../../Content/Image/UzNno.jpg" width="38" height="19" alt="Atish" />
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav">
<li><a href="#">Home</a></li>
<li><a href="#">Articles</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">About</a></li>
</ul>
<form class="navbar-search pull-left" action="">
<input type="text" class="search-query span2" placeholder="Search">
</form>
<ul class="nav pull-right">
<li class="divider-vertical"></li>
<li><a href="#">Login</a></li>
</ul>
</div>
<!-- /.nav-collapse -->
</div>
</div>
<!-- /navbar-inner -->
</div>
@RenderBody()
<script src="../../Scripts/Tree.js"></script>
</body>
</html>
我的.js文件
var elements = $("html").children();
for (var i = 0; i < elements.length; i++) {
alert(elements[i]);
}
输出
[object HTMLScriptElement]
[object HTMLScriptElement]
[object HTMLHeadElement]
[object HTMLBodyElement]
我想
[object HTMLHeadElement]
[object HTMLBodyElement]