<iframeset>
<iframe>top.htm</iframe>
<iframe>子页.htm</iframe>
</ifrmaeset>
子页是可以变的静态页,现在想在 top.htm 内取得 子页.htm 的标题和URL,可以吗,如果可以,怎么取得呢.求大侠解难!!!!!!
<iframe>top.htm</iframe>
<iframe>子页.htm</iframe>
</ifrmaeset>
子页是可以变的静态页,现在想在 top.htm 内取得 子页.htm 的标题和URL,可以吗,如果可以,怎么取得呢.求大侠解难!!!!!!
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script type="text/javascript">
function func(){
alert(top.frames['ii'].document.title);
alert(top.frames['ii'].document.location);
}</script>
</HEAD><BODY>
<frameset>
<iframe src="Noname2.html" name="ii"></iframe>
<iframe src="Noname3.html" name="bb"></iframe>
</frameset>
</BODY><input type="button" onclick="func()">
</HTML>
关键的一点是你在子页面中用js的:top 当前窗口的最顶层窗口
然后就把子页面看成 top 的子节点 依次引用就ok..
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Test </title>
<style></style>
<script></script>
</head>
<body>
<iframeset>
<iframe id="i1" src="b.html" title="t1"> top.htm </iframe>
<iframe id="i2" src="c.html" title="t2"> 子页.htm </iframe>
</ifrmaeset>
</body>
</html>
///////////////////////b.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Test </title>
<style></style>
<script>
function get(){
var obj = window.parent.document.getElementById("i2");
alert(obj.src);
alert(obj.title);
}
</script>
</head>
<body>
<input type="button" value="取地址" onclick="get()"/>
</body>
</html>
楼主说的应该是frame吧
<frameset>
<frame src="top.htm">
<frame src="子页.htm">
</frameset>