zoukankan      html  css  js  c++  java
  • jquery------脚注的使用

    index.jsp

    <script type="text/javascript" src="../js/my.js"></script>

    <
    div id="chapter"> <p>How admirable is the Law of Compensation!<span id="footnote">today is Monday!</span><span class="pull">A wonderful day!</span></p> <p>And how perfect a proof of the natural fitness!<span id="footnote">today is Friday!</span>I believe you!</p> <p>Next above these come the Nobility<span id="drop">,of Whom there are!</span><span id="footnote">today is Saturday!</span>If you work hard,you will succeed!</p> </div> <div style="500px;height:500px;"></div> <a href="#top" style="display:block;margin:0px;padding:0px">back to top</a> <div id="footer"></div>

    my.js

    $(document).ready({
    var $note=$("<ol></ol>").insertBefore("#footer");
            $("span#footnote").each(function(index){
                $(this)
                    .before(["<a href='#footnote-",
                             index+1,
                             "' id='context-",
                             index+1,
                             "' class='context'>",
                             "<sup style='font-size:15px'>",
                             index+1,
                             "</sup></a>"].join(""))   //反向插入
                    .append(["<a href='#context-",
                             index+1,
                             "'>context</a>"].join(""))
                    .appendTo($note)
                    .wrap("<li id='footnote-"+(index+1)+"'></li>");
            });
    });
  • 相关阅读:
    gradle 转 maven
    java Multimap
    java 写法推荐
    Python虚拟环境virtualenv
    C# 转换图形为PCX 格式
    微软宣布.NET开发环境将开源 支持Mac OS X和Linux
    写给在Java和.net中徘徊的新手
    HTML5 vs FLASH vs SILVERLIGHT
    我的NHibernate曲折之行
    NHibernate 3 Beginner's Guide
  • 原文地址:https://www.cnblogs.com/tianhengblogs/p/5481022.html
Copyright © 2011-2022 走看看