0

Horizo​​ntle フレームを 2 つ使用しています。トップ フレームでは、Jquery タブを使用しました。タブをクリックするたびに、結果ページが下のフレームに開くはずです。しかし、それは機能していません。誰でも私を助けてくれますか。Jquery タブはフレームをサポートしていますか?

4

1 に答える 1

0

index.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>

top.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>

cont.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 に答える