利用JQuery的load函數(shù)動態(tài)加載其它頁面的內(nèi)容的實現(xiàn)代碼
更新時間:2010年12月14日 19:59:51 作者:
利用JQuery的load函數(shù)動態(tài)加載別的頁面的代碼,方便實時獲取別的頁面的內(nèi)容。
在線演示:http://demo.jb51.net/js/JQueryload/index.htm
全部代碼
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>JQuery - Load</title>
<link rel="stylesheet" media="all" type="text/css" href="../CSS/myStyle.css" />
<script type="text/javascript" src="http://demo.jb51.net/jslib/jquery/jquery-1.3.2.min.js"></script>
<style type="text/css">
#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;
}
.buttonArea {
margin: 10px;
padding-bottom:20px;
}
#load_content {
float: left;
width: 550px;
text-align:center;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$('#btnLoad1.button').click(function() {
$('#load_content').load('loadContent1.htm');
});
$('#btnLoad2.button').click(function() {
$('#load_content').load('loadContent2.htm');
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="container">
<div id="header">
<h2>JQuery Load Example</h2>
</div>
<div class="buttonListArea">
<div class="buttonArea">
<div class="button" id="btnLoad1">Load 1</div>
</div>
<div class="buttonArea">
<div class="button" id="btnLoad2">Load 2</div>
</div>
</div>
<div id="load_content">
<h2>這是要被加載的區(qū)域</h2>
</div>
</div>
</form>
</body>
</html>
loadContent1.htm
jb51.net
loadContent2.htm
sc.jb51.net
代碼打包下載
全部代碼
復制代碼 代碼如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>JQuery - Load</title>
<link rel="stylesheet" media="all" type="text/css" href="../CSS/myStyle.css" />
<script type="text/javascript" src="http://demo.jb51.net/jslib/jquery/jquery-1.3.2.min.js"></script>
<style type="text/css">
#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;
}
.buttonArea {
margin: 10px;
padding-bottom:20px;
}
#load_content {
float: left;
width: 550px;
text-align:center;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$('#btnLoad1.button').click(function() {
$('#load_content').load('loadContent1.htm');
});
$('#btnLoad2.button').click(function() {
$('#load_content').load('loadContent2.htm');
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="container">
<div id="header">
<h2>JQuery Load Example</h2>
</div>
<div class="buttonListArea">
<div class="buttonArea">
<div class="button" id="btnLoad1">Load 1</div>
</div>
<div class="buttonArea">
<div class="button" id="btnLoad2">Load 2</div>
</div>
</div>
<div id="load_content">
<h2>這是要被加載的區(qū)域</h2>
</div>
</div>
</form>
</body>
</html>
loadContent1.htm
復制代碼 代碼如下:
jb51.net
loadContent2.htm
復制代碼 代碼如下:
sc.jb51.net
代碼打包下載
您可能感興趣的文章:
- jQuery 源代碼顯示控件 (Ajax加載方式).
- jquery實現(xiàn)ajax加載超時提示的方法
- jquery加載頁面的方法(頁面加載完成就執(zhí)行)
- jQuery頁面加載初始化常用的三種方法
- jQuery Div中加載其他頁面的實現(xiàn)代碼
- 基于JQuery實現(xiàn)滾動到頁面底端時自動加載更多信息
- 解決用jquery load加載頁面到div時,不執(zhí)行頁面js的問題
- jquery 頁面滾動到底部自動加載插件集合
- 用jQuery模擬頁面加載進度條的實現(xiàn)代碼
- Jquery實現(xiàn)頁面加載時彈出對話框代碼
- 基于jQuery實現(xiàn)模擬頁面加載進度條
- jQuery實現(xiàn)頁面滾動時動態(tài)加載內(nèi)容的方法
- jQuery常用的4種加載方式分析
相關(guān)文章
jQuery對JSON數(shù)據(jù)進行排序輸出的方法
這篇文章主要介紹了jQuery對JSON數(shù)據(jù)進行排序輸出的方法,涉及jQuery中g(shù)etJSON與sort等方法的使用技巧,需要的朋友可以參考下2015-06-06jQuery中將json數(shù)據(jù)顯示到頁面表格的方法
今天小編就為大家分享一篇jQuery中將json數(shù)據(jù)顯示到頁面表格的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-05-05jQuery旋轉(zhuǎn)插件—rotate支持(ie/Firefox/SafariOpera/Chrome)
網(wǎng)上發(fā)現(xiàn)一個很有意思的jQuery旋轉(zhuǎn)插件,支持Internet Explorer 6.0+ 、Firefox 2.0 、Safari 3 、Opera 9 、Google Chrome,高級瀏覽器下使用Transform,低版本ie使用VML實現(xiàn),感興趣的朋友可以了解下2013-01-01jQuery操作復選框(CheckBox)的取值賦值實現(xiàn)代碼
這篇文章主要介紹了jQuery操作復選框(CheckBox)的取值賦值實現(xiàn)代碼,需要的朋友可以參考下2017-01-01