将上传图片的浏览按纽放在一个表格中,将这个表格设置为显示或隐藏(type=hidden),最后在单选按钮上加JScript代码控制这个显示就好。

解决方案 »

  1.   

    <script>
    function alertTest()
    {
    if (document.all.radio_1[0].checked) document.all.tspan.style.display="";
    if (document.all.radio_1[1].checked) document.all.tspan.style.display="none";
    }
    </script> 
     <table width="500" border="1" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="136"><input type="radio" name="radio_1" value="1" onClick="alertTest()">
            a
    <input type="radio" name="radio_1" value="2" onClick="alertTest()">
            b</td>
          <td width="111" height="18" bgcolor="#E6E6E6"><span id="tspan" style="display:none"><input name="file1" type="file" id="file1"></span></td>
        </tr>
    </table>
      

  2.   

    <HTML>
    <HEAD>
    </head> 
     <body ><form name="form1" method="post" action="">
      <input name="radiobutton" type="radio" value="radiobutton" onclick="shang.style.display = ''">
      上
      <input name="radiobutton" type="radio" value="radiobutton" onclick="shang.style.display = 'none'">
      不上 
      <input type="button" name="Submit" value="按钮" style="display:none" id="shang">
    </form>
    </body>
    </html>