亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

原來(lái)Jquery.load的方法可以一直load下去

 更新時(shí)間:2011年03月28日 22:45:21   作者:  
使用jQuery.load方法加載一個(gè)網(wǎng)頁(yè),那么這個(gè)網(wǎng)頁(yè)內(nèi)部的js代碼是否能夠執(zhí)行呢,答案是肯定的,這就相當(dāng)于把load的內(nèi)容與主頁(yè)面進(jìn)行了合并一樣
只要不沖突(例如id不能一樣),我寫(xiě)了一個(gè)例子,利用頁(yè)面參數(shù)控制內(nèi)部的元素id,互相加載自己。這是一個(gè)jsp頁(yè)面,代碼如下:
復(fù)制代碼 代碼如下:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
int i = Integer.parseInt(request.getParameter("i")==null?"0":request.getParameter("i"));
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>用戶登錄</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="<%=path%>/Scripts/jquery-1.5.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#h<%= i %>").click(function(){
$("#d<%= i %>").load("<%=basePath%>index.jsp",{i:<%=i+1%>});
});
});
</script>
</head>
<body>
this is index.jsp?i=<%= i %>
<input type="button" value="get<%= i+1 %>" id="h<%= i %>">
<br>
<div id="d<%= i %>" style="border:1px; border-style: solid; margin: 5px;">load index.jsp?i=<%= i+1 %> here!</div>
</body>
</html>

運(yùn)行后如圖所示,可以一直點(diǎn)下去:

但是,如果你只取的是頁(yè)面的一部分,例如將按鈕的點(diǎn)擊代碼改成:

復(fù)制代碼 代碼如下:

$("#d<%= i %>").load("<%=basePath%>Login.action input",{i:<%=i+1%>});

那么,加載的就只是一個(gè)按鈕了,而不是整個(gè)頁(yè)面。如圖:

相關(guān)文章

最新評(píng)論