选择问题
我想实现一个功能,就是选择不同的选项,跳出不同的功能
请看代码
<tr>
<td>
<input type= "radio " value= "V1 " name= "R1 "> 从我的电脑上传 <br>
或者
<input type= "radio " value= "V1 " name= "R2 "> 输入图片URL
</td>
</tr>
<tr>
<td>
请输入图片的URL: <input type= "text " name= "T2 " size= "20 ">
</td>
</tr>
<tr>
<td>
请上传你的图片: <input type= "file " name= "T1 " size= "20 " >
</td>
</tr>
当我选择上面的R1,则下面只显示出T1,而选择R2的时候,只显示出T2,请问这个该怎么实现?
谢谢
------解决方案-------------------- <script language= "javascript ">
function hidden()
{
if(document.getElementById( "R1 ").value!= " "){
document.getElementById( "R2 ").style.display= "none ";
document.getElementById( "T2 ").style.display= "none ";
}
}
function hidden1()
{
if(document.getElementById( "R2 ").value!= " "){
document.getElementById( "R1 ").style.display= "none ";
document.getElementById( "T1 ").style.display= "none ";
}
}
</script>
<div id= "R1 "> <input type= "radio " value= "V1 " name= "R1 " onclick= "show_hidden(); "> 从我的电脑上传 <br> </div>
<div id= "R2 "> <input type= "radio " value= "V1 " name= "R2 " onclick= "show_hidden1(); "> 输入图片URL </div>
<div id= "T2 "> 请输入图片的URL: <input type= "text " name= "T2 " size= "20 "> </div>
<div id= "T1 "> 请上传你的图片: <input type= "file " name= "T1 " size= "20 " > </div>
------解决方案-------------------- <table>
<tr>
<td>
<input type=radio name= "item " onclick= "if(this.checked){trweb.style.display= 'block ';trweb2.style.display= 'none '} "> 从我的电脑上传 <br/>
<input type=radio name= "item " onclick= "if(this.checked){trweb2.style.display= 'block ';trweb.style.display= 'none '} " > 输入图片URL
</td> </tr>
<tr id= "trweb " style= "display:none "> <td> 请输入图片的URL: </td>
<td>
<input type= "text " name= "T2 " size= "20 ">
</td> </tr>
<tr id= "trweb2 " style= "display:none "> <td> 请上传你的图片: </td>
<td>
<input type= "file " name= "T1 " size= "20 " > </td> </tr>
</table>
------解决方案-------------------- <html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 新建网页 4 </title>
<script>
function a(obj){
if(obj.name== "R1 "){
document.getElementsByName( "R2 ")[0].checked=false;
document.getElementById( "T1 ").style.display= "block ";
document.getElementById( "T2 ").style.display= "none ";
}else{
docu