就是点选的<radio>值自动填到<input type="text">中

解决方案 »

  1.   

    <script language="JavaScript">
    var mySel="";
    function set_value(val)
    {
    try
    {
    getSel=mySel-1;
    inputx[getSel].value=val;
    }
    catch(e)
    {
    alert("先选择ABCD或E");
    }}
    </script>
    <br>
    <input type="radio" name="radiobutton" onclick="mySel=1;">

    <input type="text" name="inputx" >
    <br>
    <input type="radio" name="radiobutton" onclick="mySel=2;">

    <input type="text" name="inputx" >
    <br>
    <input type="radio" name="radiobutton" onclick="mySel=3;">

    <input type="text" name="inputx" >
    <br>
    <input type="radio" name="radiobutton" onclick="mySel=4;">

    <input type="text" name="inputx" >
    <br>
    <input type="radio" name="radiobutton" onclick="mySel=5;">

    <input type="text" name="inputx" >
    <p> 
      <input type="radio" name="set_value" onclick="set_value(111);">
      111 
      <input type="radio" name="set_value" onclick="set_value(222);">
      222 
      <input type="radio" name="set_value" onclick="set_value(333);">
      333 
      <input type="radio" name="set_value" onclick="set_value(444);">
      444 
      <input type="radio" name="set_value" onclick="set_value(555);">
      555
    </p>
      

  2.   

    高人,可否认识你啊?
    [email protected]马上给分!
      

  3.   

    对了,<Input>中的字能不能有颜色呢?Code?
      

  4.   

    <table border="0" width="300" cellspacing="0" cellpadding="0">
    <form name=form1>
      <tr>
        <td width="44"><input type="radio" value="v1" name="R1" onclick=clsR1()>A</td>
        <td id=v1 width="240" style="border-bottom: 1 solid #000000"> </td>
      </tr>
      <tr>
        <td width="44"><input type="radio" value="v2" name="R1" onclick=clsR1()>B</td>
        <td id=v2 width="240" style="border-bottom: 1 solid #000000"> </td>
      </tr>
      <tr>
        <td width="44"><input type="radio" value="v3" name="R1" onclick=clsR1()>C</td>
        <td id=v3 width="240" style="border-bottom: 1 solid #000000"> </td>
      </tr>
      <tr>
        <td width="44"><input type="radio" value="v4" name="R1" onclick=clsR1()>D</td>
        <td id=v4 width="240" style="border-bottom: 1 solid #000000"> </td>
      </tr>
      <tr>
        <td width="44"><input type="radio" value="v5" name="R1" onclick=clsR1()>E</td>
        <td id=v5 width="240" style="border-bottom: 1 solid #000000"> </td>
      </tr>
      <tr>
        <td width="44"><input type="radio" value="v6" name="R1" onclick=clsR1()>F</td>
        <td id=v6 width="240" style="border-bottom: 1 solid #000000"> </td>
      </tr>
     </form>
    </table><table border="1" width="76%">
    <form name=form2>
      <tr>
        <td width="16%"><input type="radio" value="w1" name="R2" onclick=seltoR1()><span id=w1>111</span></td>
        <td width="16%"><input type="radio" value="w2" name="R2" onclick=seltoR1()><span id=w2>222</span></td>
        <td width="17%"><input type="radio" value="w3" name="R2" onclick=seltoR1()><span id=w3>333</span></td>
        <td width="17%"><input type="radio" value="w4" name="R2" onclick=seltoR1()><span id=w4>444</span></td>
        <td width="17%"><input type="radio" value="w5" name="R2" onclick=seltoR1()><span id=w5>555</span></td>
        <td width="17%"><input type="radio" value="w6" name="R2" onclick=seltoR1()><span id=w6>666</span></td>
      </tr>
     </form>
    </table>
    <script>
    function clsR1(){
    n=document.all.R1.length;
    for (i=0;i<n;i++){
    if (document.all.R1[i].checked==false){
    idvar=document.all.R1[i].value;
    //eval(idvar+".innerText=' '");
    }
    }
    }
    function seltoR1(){
    n=document.all.R1.length;
    for (i=0;i<n;i++){
    if (document.all.R1[i].checked){
    m=document.all.R2.length;
    for (j=0;j<m;j++){
    if (document.all.R2[j].checked){
    idvar1=document.all.R1[i].value;//alert(idvar1);
    idvar2=document.all.R2[j].value;
    eval(idvar1+".innerText="+idvar2+".innerText");
    }

    }

    }
    }

    }
    </script>
      

  5.   

    还有一问题,<input>中的值符合一定条件时字体就为红色,如填的值为111,就红色显示