+ -
当前位置:首页 → 问答吧 → 新手,求助~~~~~

新手,求助~~~~~

时间:2009-09-02

来源:互联网

在<div class=chapter>下所有的p的后面加上一个back to top 的超链接。为什么在页面中不显示back to top 的超链接?
<script  type="text/javascript">
    
    
     $(document).ready(function(){
       $("<a href="#top">back to top</a>").insertAfter("div.chapter p");
        $("<a id="top"></a>");
        });
    
    
    </script>

作者: yangna   发布时间: 2009-09-02

复制代码
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  5. <title>test</title>
  6. </head>
  7. <script type="text/javascript" src="jquery.js"></script>
  8. <script type="text/javascript">
  9. $(function(){
  10.   $(".chapter p").after("<a href='#top'>back to top</a>");
  11. })
  12. </script>
  13. <body>
  14. <div class="chapter">
  15.     <p>1</p>
  16.     <p>1</p>
  17.     <p>1</p>
  18.     <p>1</p>
  19.     <p>1</p>
  20.     <p>1</p>
  21. </div>
  22. </body>
  23. </html>

作者: chiyuderen   发布时间: 2009-09-02

谢谢1楼!!!

作者: yangna   发布时间: 2009-09-03

相关阅读 更多