<input type="hidden" id="headline">
xxx
<input type="hidden" id="footline">原生js或者jquery都可以

解决方案 »

  1.   

    <!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>
    <script type="text/javascript">
    function init(){
    var a=document.getElementById("headline");
    var b=document.getElementById("footline");
    var an=a.nextSibling;
    while(b!=an){
    var p=an.parentNode;
    p.removeChild(an);
    an=a.nextSibling;
    }
    }
    window.onload=init;
    </script>
    </head><body>
    <input type="hidden" id="headline">
    <div>11</div>sss
    <a href="">xx</a>
    <input type="hidden" id="footline">
    </body>
    </html>
    类似这样试试
      

  2.   


    //firefox和chrome支持,ie6不支持
    var start= document.getElementById("headline");
    ff= start.nextSibling);
    ff.nodeValue="abcd";
      

  3.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>123</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            function test(){
                var headline = document.getElementById("headline");
                var txt = headline.nextSibling;
                alert("原文本为:" + txt.nodeValue);
                txt.nodeValue = " oh, my god! ";
                alert("替换后的文本为:" + txt.nodeValue);
            }
        </script>
    </head>
    <body>
        <div id="divContainer">
            <input type="text" id="headline" value ="headline" />
            xxx
            <input type="text" id="footline" value ="footline" />
        </div>
        <input type="button" value="test" onclick="test()" />
    </body>
    </html>
      

  4.   

    哦.是把 div A 里面的内容 与div B 里面的内容 互换吗?
      

  5.   

    把标签内的内容替换么,在标签中写上id,写个函数,里面内容为document.getElementById('id').innerHTML="更改内容信息";
      

  6.   

    楼主是来戏谑我们的, 你看他说替换两div, 给出的code却是 input