父框架frameset.htm<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>影片列表</title>
</head><frameset cols="243,*"> <frame id="LeftFrame" name="LeftFrame" src="http://www.google.cn/" />
<frame id="RightFrame" name="RightFrame" src="info.htm" /></frameset></html>frame页info.htm<html>
<head>
<title></title>
<script>
function p(param)
{
window.alert(param);
}
</script>
</head><body>
<a target="_top" href="javascript:p('abc');">弹出窗口</a>
</body>
</html>
问题描述:访问frameset.htm,单击“弹出窗口”后函数始终无法执行(IE8、Firefox3.5),而直接访问info.htm则没有问题
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>影片列表</title>
</head><frameset cols="243,*"> <frame id="LeftFrame" name="LeftFrame" src="http://www.google.cn/" />
<frame id="RightFrame" name="RightFrame" src="info.htm" /></frameset></html>frame页info.htm<html>
<head>
<title></title>
<script>
function p(param)
{
window.alert(param);
}
</script>
</head><body>
<a target="_top" href="javascript:p('abc');">弹出窗口</a>
</body>
</html>
问题描述:访问frameset.htm,单击“弹出窗口”后函数始终无法执行(IE8、Firefox3.5),而直接访问info.htm则没有问题
<html>
<head>
<title></title>
<script>
function p(param)
{
alert(param);
}
</script>
</head><body>
<a target="_top" href="javascript:top.RightFrame.p('abc');">弹出窗口</a>
</body>
</html>
2.将info.htm中的script标签移到frameset.htm中,
[/code]因为你设置了target为_top,会到顶层窗口去查找