jquery 操作 frame
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="../../script/jquery-1.6.2.js"></script>
<script type="text/javascript">
var nav;
nav={
nav_1:
{
navName:"导航1",
nav_1_1:"导航1_1",nav_1_2:"导航1_2",nav_1_3:"导航1_3",nav_1_4:"导航1_4"
},
nav_2:
{
navName:"导航2",
nav_2_1:"导航2_1",nav_2_2:"导航2_2",nav_2_3:"导航2_3",nav_2_4:"导航1_4"
},
nav_3:
{
navName:"导航3",
nav_3_1:"导航3_1",nav_3_2:"导航3_2",nav_3_3:"导航2_3",nav_3_4:"导航1_4"
},
nav_4:
{
navName:"导航4",
nav_4_1:"导航4_1",nav_4_2:"导航4_2",nav_4_3:"导航4_3",nav_4_4:"导航4_4"
}
};
$(document).ready(function(){
var temFrame=$(window.frames['top'].document);
var temFrame2=temFrame.find("ul");
for(var x in nav)
{
tem="<li id="+x+">"+nav[x]["navName"]+"</li>";
temFrame2.append(tem);
}
});
</script>
</head>
<frameset rows="111,*" cols="*" frameborder="0" border="0" style="margin-left:180px;">
<frame src="top.html" name="top" noresize="noresize"/>
<frameset rows="*" cols="158,*" frameborder="0" border="0">
<frame src="bottomLeft.html" name="bottomLeft" noresize="noresize" scrolling="no"/>
<frame src="bottomRight.html" name="bottomRight" noresize="noresize"/>
</frameset>
</frameset><noframes></noframes>
</html>
//var temFrame2=temFrame.find("ul") 中 temFrame2为空,不知道为什么,另外,我在top.html 中写 $(document).find("ul") 却不为空,其实实问题就是一个用JQUERY选中其中一个名叫top的frame操作里面的元素的脚本,望各位高手帮一帮小弟 展开
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="../../script/jquery-1.6.2.js"></script>
<script type="text/javascript">
var nav;
nav={
nav_1:
{
navName:"导航1",
nav_1_1:"导航1_1",nav_1_2:"导航1_2",nav_1_3:"导航1_3",nav_1_4:"导航1_4"
},
nav_2:
{
navName:"导航2",
nav_2_1:"导航2_1",nav_2_2:"导航2_2",nav_2_3:"导航2_3",nav_2_4:"导航1_4"
},
nav_3:
{
navName:"导航3",
nav_3_1:"导航3_1",nav_3_2:"导航3_2",nav_3_3:"导航2_3",nav_3_4:"导航1_4"
},
nav_4:
{
navName:"导航4",
nav_4_1:"导航4_1",nav_4_2:"导航4_2",nav_4_3:"导航4_3",nav_4_4:"导航4_4"
}
};
$(document).ready(function(){
var temFrame=$(window.frames['top'].document);
var temFrame2=temFrame.find("ul");
for(var x in nav)
{
tem="<li id="+x+">"+nav[x]["navName"]+"</li>";
temFrame2.append(tem);
}
});
</script>
</head>
<frameset rows="111,*" cols="*" frameborder="0" border="0" style="margin-left:180px;">
<frame src="top.html" name="top" noresize="noresize"/>
<frameset rows="*" cols="158,*" frameborder="0" border="0">
<frame src="bottomLeft.html" name="bottomLeft" noresize="noresize" scrolling="no"/>
<frame src="bottomRight.html" name="bottomRight" noresize="noresize"/>
</frameset>
</frameset><noframes></noframes>
</html>
//var temFrame2=temFrame.find("ul") 中 temFrame2为空,不知道为什么,另外,我在top.html 中写 $(document).find("ul") 却不为空,其实实问题就是一个用JQUERY选中其中一个名叫top的frame操作里面的元素的脚本,望各位高手帮一帮小弟 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询