转载网址:http://hi.baidu.com/pdj408/item/b3cfdb2adbf736c6a517b698
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
< html > < head > < title >配置管理</ title > < meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" > < style type = "text/css" > frame{margin: 0;padding: 0;} frameset {margin: 0;padding: 0;} </ style > </ head > < frameset rows = "88,*,30" framespacing = "0" border = "no" > < frame src = "${ctx}/jsp/manage/manage-head.jsp" id = "head" name = "head" scrolling = "no" frameborder = "0" > < frameset cols = "192,*" framespacing = "0" border = "no" > < frame src = "${ctx}/jsp/manage/manage-left.jsp" scrolling = "no" frameborder = "0" > < frame src = "${ctx}/jsp/manage/manage-context.jsp" name = "_link" scrolling = "no" frameborder = "0" > </ frameset > < frame src = "${ctx}/jsp/manage/magage-foot.jsp" scrolling = "no" frameborder = "0" > </ frameset > </html |
我在manage-context.jsp下页面中通过jquery获取/修改manage-head.jsp中的内容
var head=$(window.parent.parent.frames["head"].document);//获取head页面,这是一个文档树对象。
下面是manage-head.jsp中一段代码
1
2
3
4
5
6
7
8
9
10
|
< div id = "t_div" > < div id = "ul" class = "t_link_div_left" > < ul class = "t_link_class" > < c:forEach items = "${linkList}" var = "linkInfo" > < li class = "" >< a id = "linkUrl" class = "link-href-info" target = "_link" href = "${linkInfo.linkUrl}" >< span >${linkInfo.linkName}</ span ></ a ></ li > </ c:forEach > < div class = "clear" ></ div > </ ul > </ div > </ div > |
var div=head.find("#ul"); //获取链接的这个div
var ul=ul.find(".t_link_class");//通过上面div对象获取到ul
ul.find("li").remove();//删除ul下面的所有li
//向ul中添加li
for(var i=0;i<data.list.length;i++){
var linkUrl=data.list[i].linkUrl;
var linkName=data.list[i].linkName;
ul.append("<li class=''><a id='linkUrl' class='link-href-info' target='_link' href="+linkUrl+"><span>"+linkName+"</span></a></li>");
}