手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >利用JQuery的load函数动态加载其它页面的内容的实现代码
利用JQuery的load函数动态加载其它页面的内容的实现代码
摘要:在线演示:http://demo.jb51.net/js/JQueryload/index.htm全部代码复制代码代码如下:JQuery-L...

在线演示: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>

<div>

<div id="btnLoad1">Load 1</div>

</div>

<div>

<div id="btnLoad2">Load 2</div>

</div>

</div>

<div id="load_content">

<h2>这是要被加载的区域</h2>

</div>

</div>

</form>

</body>

</html>

loadContent1.htm

复制代码 代码如下:

jb51.net

loadContent2.htm

复制代码 代码如下:

sc.jb51.net

代码打包下载

【利用JQuery的load函数动态加载其它页面的内容的实现代码】相关文章:

jquery实现动态改变div宽度和高度

jQuery预加载图片常用方法

Jquery动态添加输入框的方法

jQuery实现给页面换肤的方法

js实现异步循环实现代码

些很实用且必用的小脚本代码

jQuery处理图片加载失败的常用方法

解决未知尺寸的图片撑破页面的问题

打印/预览/设置的客户端代码

jQuery构造函数init参数分析续

精品推荐
分类导航