Jquery异步加载页面(load)
想实现Jquery 加载完页面内容再显示出内容来吗?使用 load函数即可实现
2010-05-21
话不多说,上图先。
第一步:
第二步 点击“load 1“按钮。出现”正在加载…”
第三步:加载完成
JS代码:
HTML代码:
.buttonArea
{
margin: 10px;
padding-bottom: 20px;
}
#load_content
{
float: left;
width: 550px;
text-align: center;
}
–></mce:style><style type=”text/css” mce_bogus=”1″> #header
{
margin-bottom: 1em;
padding-bottom: 1em;
border-bottom: 1px solid #eee;
}
.buttonListArea
{
float: left;
width: 150px;
padding-right: 10px;
border-right: 1px solid #eee;
margin-right: 10px;
}
.button
{
cursor:pointer;
}
.buttonArea
{
margin: 10px;
padding-bottom: 20px;
}
#load_content
{
float: left;
width: 550px;
text-align: center;
}
</style>
</head>
<body>
<form id=”form1″ runat=”server”>
<div id=”container”>
<div id=”header”>
<h2>加载演示</h2>
</div>
<div class=”buttonListArea”>
<div class=”buttonArea”>
<div class=”button” id=”btnLoad1″> Load 1</div>
</div>
</div>
<div id=”load_content”>
<h2>这是要被加载的区域</h2>
</div>
</div>
</form>
</body>
</html>