如图,可以关闭的,最右边一栏点了可以添加新选项卡,自己试了很久搞不定,求高手

解决方案 »

  1.   

    点击新增createElement创建div
    这个div里创建一个按钮  value="X"
    为按钮增加点击事件 点击后
    获得按钮的父元素的父元素 用这个元素removeChild(按钮父元素)
    将这个div insertBefore到添加按钮前
    试试
      

  2.   

    <!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=utf-8" />
    <title>无标题文档</title>
    <style type="text/css">
    td{
    width:100px;
    background-image:url(1.jpg);
    direction:rtl;
    }
    </style>
    <script type="text/javascript">
    function add(){
    var button=document.getElementById("test");
    var p=button.parentNode;
    var td=document.createElement("td");
    var close=document.createElement("input");
    close.type="button";
    close.value="X";
    close.onclick=remove;
    td.appendChild(close);
    var pp=p.parentNode;
    pp.insertBefore(td,p);
    }
    function remove(){
    var p=this.parentNode;
    var pp=p.parentNode;
    pp.removeChild(p);
    }
    </script>
    </head><body>
    <table>
    <tr>
         <td><input type="button" value="增加" onclick="add()" id="test"></td>
        </tr>
    </table>
    </body>
    </html>
    大体类似于这样试试
      

  3.   

    基于jQuery实现的标签页:http://webzixue.iteye.com/blog/1520002