0

我正在使用 2 个水平框架。在顶部框架中,我使用了 Jquery 选项卡。我希望每当我点击选项卡时,结果页面应该在下面的框架中打开。但它不起作用。任何人都可以帮助我吗?Jquery Tabs 是否支持框架?

4

1 回答 1

0

索引.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<frameset rows="80,*" frameborder="no" border="0" framespacing="0">
  <frame src="top.html" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
  <frame src="cont.html" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>

顶部.html:

<!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=iso-8859-1" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script language="JavaScript">

$(function(){

    $("#test").click(function(){
        alert( $(window.parent.document.frames["mainFrame"].document).find("body").html() );
        $(window.parent.document.frames["mainFrame"].document).find("body").html("<div>this is a test</div>");
        alert( $(window.parent.document.frames["mainFrame"].document).find("body").html() );
    }); 
});

</script>
</head>
<body>
    <button id="test">test</button>
</body>
</html>

续.html:

<!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=iso-8859-1" />
</head>
<body>
    <div>empty</div>
</body>
</html>
于 2009-10-20T13:28:41.037 回答