如题,我想做一个页面当前位置的标识,我本来有这样一个HTML文件:hot.html,而这个文件当中有几个链接是是链接到另一个中的非全开状态(我不知道专业术语,我说的“非全开”即页面的完整状态,需要根据用户的操作来展示某一块内容)。
例如:我点击hot.html中的“参看详情”链接,转到detail.html?id=abc的页面当中,此时的页面是id=abc的版块是展开的,其余的版块不显示。而位置标识部分由原来的“首页>热门资源”(hot.html中的标识)变成“首页>热门资源>XXX”(detail.html?id=abc中的标识,“XXX”是名为id=abc版块的主标题。)
换句话说就是,标识最后一个节点是动态生成的。我的思路是用JS来控制最后一个节点的值,也就是用JS控制<a></a>标签之间的值。请问用CSS+JS技术能不能做到?望大侠们拔刀相助,小弟跪谢!!

解决方案 »

  1.   

    Page1
    <!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>
    <title>Page1</title>
    </head>
    <body>
    <h1>
    Page1</h1>
    <p>
    <a href="page2.html#b1">Go block 1</a></p>
    <p>
    <a href="page2.html#b2">Go block 2</a></p>
    </body>
    </html>
    Page2
    <!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>
    <title>Page2</title>
    <style type="text/css">
    h4 { cursor: pointer; font-weight: normal; background: #ddd; }
    p { display: none; }
    </style>
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    var blocks = ["#b1", "#b2"];
    for (var i = 0; i < blocks.length; i++) {
    $(blocks[i]).click(function () {
    $(this).find('p').slideToggle('slow');
    }); if (location.hash === blocks[i]) {
    $(blocks[i]).find('p').slideDown('slow');
    return;
    }
    }
    });
    </script>
    </head>
    <body>
    <h1>
    Page2</h1>
    <div id="b1">
    <h4>
    I'm paragraph p1, click to collapse/expand</h4>
    <p>
    Somebody help me?</p>
    </div>
    <div id="b2">
    <h4>
    I'm paragraph p2, click to collapse/expand</h4>
    <p>
    Need a hand?</p>
    </div>
    </body>
    </html>
      

  2.   

    ps:Using your own configuration replace the jQuery file path, or using "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" directly.
      

  3.   


    Can you do thid by "js" only?not jQuery,I'll always make my pages simple.
    And are you Chinese?Can you speak Chinese?
    Thanks for your guides!