使用框架集引用的框架

时间:2015-10-11 14:03:06

标签: javascript html5 parent-child frame

我想在右侧框架中加载此页面的内容,我该如何指定?

<html>
    <head>
    <script type="text/javascript">
    function LoadInCenter(doc1)
    {
       parent.right_bottom.location.href = doc1
    }
</script>
    </head>
    <body align="center">
        <a href="javascript:LoadInCenter('myproduct.html')">test</a>
    </body>
</html>

这是一个包含我创建的框架的页面,左侧栏为导航窗格,右侧为显示内容的位置。当用户点击左侧的任何链接时,它应该在中间显示。我如何实现这一目标?

<?php

?>

<!DOCTYPE html>
<html>
<frameset rows="15%,75%">
    <frame src="loggedin.php">
    <frameset cols="15%,75%">
        <frameset rows="5%,5%,5%,5%,*">
            <frame src="myprofile.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" name="myprofile">
            <frame src="mycompany.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" border="0" name="mycompany">
            <frame src="myproduct.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" border="0" name="myproduct">
            <frame src="market.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" border="0" name="market">      
        <frame src="">
    </frameset>
    </frameset>
</frameset>

</html>

1 个答案:

答案 0 :(得分:0)

这是上面发布的问题的答案。我已经说过了我想要实现的目标。这是将框架集拆分为标题,侧边栏和内容区域。 标题是显示与公司相关的徽标和其他内容。这行代码实现了:

<frame src="loggedin.php">

侧边栏用作导航链接,当点击任何这些链接时,内容应显示在内容区域中。这行代码实现了:

<frameset rows="5%,5%,5%,5%,*">
                <frame src="myprofile.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" name="myprofile">
                <frame src="mycompany.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" border="0" name="mycompany">
                <frame src="myproduct.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" border="0" name="myproduct">
                <frame src="market.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" border="0" name="market">      
                <frame src="" >
            </frameset>

最后一部分是占据页面其余部分的内容区域。这行代码显示:

<frame src="empty.html" noresize="noresize" marginwidth="5" marginheight="5" name="centerpage">

所以,这是完整的代码。任何人都可以复制和粘贴以查看输出。

<!DOCTYPE html>
<html>
<frameset rows="15%,75%">
    <frame src="loggedin.php">
    <frameset cols="15%,75%">
        <frameset rows="5%,5%,5%,5%,*">
            <frame src="myprofile.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" name="myprofile">
            <frame src="mycompany.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" border="0" name="mycompany">
            <frame src="myproduct.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" border="0" name="myproduct">
            <frame src="market.html" noresize="noresize" scrolling="no" marginwidth="5" marginheight="5" border="0" name="market">      
            <frame src="" >
        </frameset>
        <frame src="empty.html" noresize="noresize" marginwidth="5" marginheight="5" name="centerpage">
    </frameset>
</frameset>

</html>