定义一个变量 var a = true; 点击按钮 
if(a) 
{
显示;
a=false;
}
else
{清空;
a=true;}

解决方案 »

  1.   

    说白了就是js控制div 
    表单有的东西 通过js 让在div中也存在
      

  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=gb2312" />
    <title>无标题文档</title><style type="text/css">
    #div1{ float:left}
    #div2{width:200px; height:100px; line-height:100px; text-align:center; background:#eee; float:left}
    </style>
    </head><body>
    <div id="div1">
    <input type="text" id ="text1"/>
    <input type="button" value="click me" onclick="modity();" />
    </div><div id="div2"></div>
    </body>
    </html>
    <script type="text/javascript">function modity()
    {
    if(document.getElementById("div2").innerHTML != "")
    {
    document.getElementById("div2").innerHTML ="";
    }
    else
    {
    document.getElementById("div2").innerHTML = "你好! " + document.getElementById("text1").value;
    }
    }
    </script>---
    这样的行不?
      

  3.   

    楼上的,你写的和我要的快接近了.
    我的意思是 页面有两部分.A和B  A控制B,同时A中的内容传递到B中显示,B中除了显示A中的内容还要加上例如text.
    您看这样麻烦吗
      

  4.   

    <!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=gb2312" />
    <title>无标题文档</title><style type="text/css">
    #div1{float:left}
    #div2{width:200px; height:100px; line-height:100px; text-align:center; background:#eee; float:left}
    </style>
    </head><body>
    <div id="div1">
    <input type="text" id ="text1" onKeyUp="change();"/>
    <input type="button" value="click me" onclick="modity();" />
    </div><div id="div2"></div>
    </body>
    </html>
    <script type="text/javascript">function modity()
    { document.getElementById("div2").innerHTML ="";}function change()
    {
    document.getElementById("div2").innerHTML = "你好! " + document.getElementById("text1").value;
    }
    </script>
      

  5.   

    不是这个意思,就是A中的内容(假如 A中内容有:帐号,姓名)我点击此内容后显示到B中,此时B中会出现(帐号,姓名..等A中有的的东西)并且B中还有自己的东西,如text.当我再此点击A中的内容时,B中的内容就没了.再次点击又出现了.
      

  6.   

    <body>
    <script language="javascript">
    function doIt(obj){
        var oCon = document.getElementById("conDiv");
        if(obj.clonedObj == null){
            var oNewCode = obj.cloneNode(true);
            obj.clonedObj = oNewCode;
            oCon.insertAdjacentElement("beforeEnd", oNewCode);
        } else {
            var oNewCode = obj.clonedObj;
            oNewCode.removeNode(true);
            obj.clonedObj = null;
        }
    }
    </script>
    <form>
    <input type="text" onclick="doIt(this)" value="a text" >
    <input type="button" value="click me" onclick="doIt(this)" >
    <div id="conDiv" style="border:1px solid orange;position:absolute;width:200;height:300;right:50;top:50;background-color:FFFF99">
    <input value="XXXXX">
    </div>
    </form>
    </body>Try this...
      

  7.   

    改进,支持IE,NS,FF等浏览器<body>
    <script language="javascript">
    function doIt(obj){
        var oCon = document.getElementById("conDiv");
        var oHidDiv = document.getElementById("hidDiv");
        if(obj.clonedObj == null){
            var oNewCode = obj.cloneNode(true);
            obj.clonedObj = oNewCode;
            oCon.insertBefore(oNewCode,oHidDiv);
        } else {
            var oNewCode = obj.clonedObj;
            var oParentNode = oNewCode.parentNode;
            oParentNode.removeChild(oNewCode);
            obj.clonedObj = null;
        }
    }
    </script>
    <form>
    <input type="text" onclick="doIt(this)" value="a text" >
    <input type="button" value="click me" onclick="doIt(this)" >
    <div id="conDiv" style="border:1px solid orange;position:absolute;width:200;height:300;right:50;top:50;background-color:FFFF99">
    <input value="XXXXX">
    <!--为了兼容Netscape和Firefox等浏览器的insertBefore方法,加入一个辅助层hidDiv-->
    <div id="hidDiv"></div>
    </div>
    </form>
    </body>