比如有2个text 名字分别是 a,b 你想把a的值给bform的名字是form1在按牛处写一个onclik事件 <input type="button" onclick="form1.b.text=form1.a.text">

解决方案 »

  1.   

    如果a是radio或checkbox就写<input type="button" onclick="form1.b.text=form1.a.value">
      

  2.   

    <script language="javaScript">
    function setValue()
    {
    var str="";
    with(document.all)
    {
    for(i=0;i<checkbox.length;i++)
    {
    if(checkbox[i].checked)
    str+=checkbox[i].nextSibling.nodeValue;
    }
    for(i=0;i<radiobutton.length;i++)
    {
    if(radiobutton[i].checked)
    str+=radiobutton[i].nextSibling.nodeValue;
    }
    str+=text1.value;
    text2.value=str;
    }
    }
    </script>
    <input type="checkbox" name="checkbox">abc<br>
    <input type="checkbox" name="checkbox">def<br>
    <input type="radio" name="radiobutton">aaa<br>
    <input type="radio" name="radiobutton">bbb<br>
    <input type="text" name="text1">
    <input type="button" value="确定" onclick="setValue()"><hr>
    <input type="text" name="text2">