主页test.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>welcome</title>
</head><frameset cols="*,1024,*" border="0" framespacing="0" frameborder="0">
<frame src="TEST_files/background.htm">
<frameset id="frameSetTop" rows="82,*,20" frameborder="no" framespacing="0">
<frame name="frameTop" src="TEST_files/Frametop.htm" noresize="noresize" scrolling="no">
<frameset id="frameSetMain" cols="9,*" rows="*" frameborder="no" framespacing="0">
<frame name="frameLeft" src="TEST_files/LoadingL.htm" noresize="noresize">
<frame name="frameMain" src="TEST_files/LoadingM.htm" noresize="noresize">
</frameset>
<frame name="frameBottom" src="TEST_files/Framebottom.htm" noresize="noresize" scrolling="no">
</frameset>
<frame src="TEST_files/background.htm">
</frameset>
</html>嵌套的LoadingM.htm
<table class="grid0">
<tbody>
<tr>
<td align="center" nowrap="nowrap">张三 </td>
<td align="center" nowrap="nowrap"><a href="http://10.14.101.251:8080/has/Out.action?op=cardetail">学号</a></td>
<td align="center" nowrap="nowrap">5</td>
<td align="center" nowrap="nowrap">sss</td>
<td align="center" nowrap="nowrap"><a href="http://102.145.101.251:8080/has/car_audit/CarAudit%21Wetail.action?tht=36.35&x_carId=138&op=wetail">36.35</a></td>
<td align="center" nowrap="nowrap">4</td>
<td align="center" nowrap="nowrap">14</td>
<td align="center" nowrap="nowrap">
<a align="center" nowrap="" href="http://10.14.111.60:8081/image/ANE.JPG" target="_blank">原图<br></a>
</td>
</tr>
<tr>
<td align="center" nowrap="nowrap">李四 </td>
<td align="center" nowrap="nowrap"><a href="http://10.14.101.251:8080/has/Out.action?op=cardetail">学号</a></td>
<td align="center" nowrap="nowrap">5</td>
<td align="center" nowrap="nowrap">sss</td>
<td align="center" nowrap="nowrap"><a href="http://102.145.101.251:8080/has/car_audit/CarAudit%21Wetail.action?tht=36.35&x_carId=138&op=wetail">36.35</a></td>
<td align="center" nowrap="nowrap">4</td>
<td align="center" nowrap="nowrap">14</td>
<td align="center" nowrap="nowrap">
<a align="center" nowrap="" href="http://10.14.111.60:8081/image/ABB.JPG" target="_blank">原图<br></a>
</td>
</tr>
</tbody>
</table><script>
table=document.getElementsByTagName('table')[0];
as=table.getElementsByTagName('a');
var href='';
for(var i=0;i<as.length;i++)
{
if(as[i].innerHTML.indexOf('原图')==0)
{href=as[i].href;
alert(href) ;}
}
</script>
现在想做个插件,就不知道运行test.htm后,如何获得 指向LoadingM.htm页面中的所有"原图"的超链接?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>welcome</title>
</head><frameset cols="*,1024,*" border="0" framespacing="0" frameborder="0">
<frame src="TEST_files/background.htm">
<frameset id="frameSetTop" rows="82,*,20" frameborder="no" framespacing="0">
<frame name="frameTop" src="TEST_files/Frametop.htm" noresize="noresize" scrolling="no">
<frameset id="frameSetMain" cols="9,*" rows="*" frameborder="no" framespacing="0">
<frame name="frameLeft" src="TEST_files/LoadingL.htm" noresize="noresize">
<frame name="frameMain" src="TEST_files/LoadingM.htm" noresize="noresize">
</frameset>
<frame name="frameBottom" src="TEST_files/Framebottom.htm" noresize="noresize" scrolling="no">
</frameset>
<frame src="TEST_files/background.htm">
</frameset>
</html>嵌套的LoadingM.htm
<table class="grid0">
<tbody>
<tr>
<td align="center" nowrap="nowrap">张三 </td>
<td align="center" nowrap="nowrap"><a href="http://10.14.101.251:8080/has/Out.action?op=cardetail">学号</a></td>
<td align="center" nowrap="nowrap">5</td>
<td align="center" nowrap="nowrap">sss</td>
<td align="center" nowrap="nowrap"><a href="http://102.145.101.251:8080/has/car_audit/CarAudit%21Wetail.action?tht=36.35&x_carId=138&op=wetail">36.35</a></td>
<td align="center" nowrap="nowrap">4</td>
<td align="center" nowrap="nowrap">14</td>
<td align="center" nowrap="nowrap">
<a align="center" nowrap="" href="http://10.14.111.60:8081/image/ANE.JPG" target="_blank">原图<br></a>
</td>
</tr>
<tr>
<td align="center" nowrap="nowrap">李四 </td>
<td align="center" nowrap="nowrap"><a href="http://10.14.101.251:8080/has/Out.action?op=cardetail">学号</a></td>
<td align="center" nowrap="nowrap">5</td>
<td align="center" nowrap="nowrap">sss</td>
<td align="center" nowrap="nowrap"><a href="http://102.145.101.251:8080/has/car_audit/CarAudit%21Wetail.action?tht=36.35&x_carId=138&op=wetail">36.35</a></td>
<td align="center" nowrap="nowrap">4</td>
<td align="center" nowrap="nowrap">14</td>
<td align="center" nowrap="nowrap">
<a align="center" nowrap="" href="http://10.14.111.60:8081/image/ABB.JPG" target="_blank">原图<br></a>
</td>
</tr>
</tbody>
</table><script>
table=document.getElementsByTagName('table')[0];
as=table.getElementsByTagName('a');
var href='';
for(var i=0;i<as.length;i++)
{
if(as[i].innerHTML.indexOf('原图')==0)
{href=as[i].href;
alert(href) ;}
}
</script>
现在想做个插件,就不知道运行test.htm后,如何获得 指向LoadingM.htm页面中的所有"原图"的超链接?
as=table.getElementsByTagName('a');
var href='';
for(var i=0;i<as.length;i++)if(as[i].innerHTML.indexOf('原图')==0)href=as[i].href+',';//组合起来,提供给其他框架来获取这个变量就行了
从其他框架获取LoadingM.htm的变量
var href=parent.getElementById('frameMain').contentWindow.href楼主去了解下frame,iframe,window.open的引用关系就很简单了