本帖最后由 lukylfm 于 2010-06-01 18:04:59 编辑

解决方案 »

  1.   

    $("#radio").change(function(){
      $("input[type=text]").hide();
      $("#txt").show();
    });
      

  2.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>test</title>
    <script>
    function c(o){
    if(o.checked){
    var on = o.nextSibling;
    if(on.style.display!='none'){
    return;
    }else{
    on.style.display = "inline";
    var os = document.getElementsByName(o.name);
    for(var i=0;i<os.length;i++){
    if(os[i]!=o){
    on = os[i].nextSibling;
    on.style.display = "none";
    }
    }
    }
    }
    }
    </script>
    </head><body>
    <input type="radio" name="r1" onclick="c(this)" value="1" checked><span>1</span>
    <input type="radio" name="r1" onclick="c(this)" value="2"><span style="display:none">2</span>
    <input type="radio" name="r1" onclick="c(this)" value="3"><span style="display:none">3</span>
    <input type="radio" name="r1" onclick="c(this)" value="4"><span style="display:none">4</span>
    <input type="radio" name="r1" onclick="c(this)" value="5"><span style="display:none">5</span>
    <br>
    <input type="radio" name="r2" onclick="c(this)" value="1" checked><span>一</span>
    <input type="radio" name="r2" onclick="c(this)" value="2"><span style="display:none">二</span>
    <input type="radio" name="r2" onclick="c(this)" value="3"><span style="display:none">三</span>
    <input type="radio" name="r2" onclick="c(this)" value="4"><span style="display:none">四</span>
    <input type="radio" name="r2" onclick="c(this)" value="5"><span style="display:none">五</span>
    </body></html>
      

  3.   


    跟我想要的不太一样
    具体说一下<form name="form1" action="test.php" method="post" > 
    <tr>
     <td>是否要截取链接</td>
     <td><input type="radio" name="sub" value="1">截取</td> <td><input type="radio" name="sub" value="2" />不截取</td></tr>
    <input type="submit" />
    我想当选则截取时,出现文本框输入截取规则<input typy="text" name="sub"/>
    而且我想接收这个截取规则的值
      

  4.   

    $("radio").click(function() {
    $("#sub").toggle();--- 输入截取规则<input typy="text" name="sub" id="sub"  style="display:none"/> })就不用JS写了啊,JS比较麻烦
      

  5.   

    <td><input type="radio" name="sub" value="1" id="jiequ">截取</td>$("#jiequ").click(function() {  
    $("#sub").toggle();--- 输入截取规则<input typy="text" name="sub" id="sub" style="display:none"/>})
    没实验,应该是好使的 <td><input type="radio" name="sub" value="2" />不截取</td>
      

  6.   

    <!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=utf-8" />
    <title>无标题文档</title>
    </head><body>
    <form name="form1" action="test.php" method="post" > 
    <tr>
     <td>是否要截取链接</td>
     <td><input type="radio" name="sub" value="1" id="sub" onClick="changeType(true);">截取<input type="text" name="sub1" id="sub1" style="display:none;"/></td> <td><input type="radio" name="sub" value="2" onClick="changeType(false);"/>不截取</td></tr>
    <input type="submit" />
    </form>
    <script type="text/javascript">
    function changeType(jiequ)
    {
       var objSub=document.getElementById("sub");
       var objSub1=document.getElementById("sub1");
       if(jiequ)
       {
         objSub.style.display="none";
         objSub1.style.display="block";
       }
       else
       {
         objSub.style.display="block";
         objSub1.style.display="none";
       }
    }
    </script>
    </body>
    </html>
      

  7.   

    <!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=utf-8" />
    <title>无标题文档</title>
    </head><body>
    <form name="form1" action="test.php" method="post" >
    <div style="width:auto;height:30px;">
         <div style="width:120px;height:30px;float:left;">是否要截取链接</div>
         <div style="width:auto;float:left;"><input type="radio" name="sub" value="1" id="sub" onClick="changeType(true);"></div>
         <div style="width:auto;float:left;">截取</div>
         <div style="width:auto;float:left"><input type="text" name="sub1" id="sub1" style="display:none;"/></div>
         <div style="width:auto;float:left;margin-left:10px;display:inline;"><input type="radio" name="sub" value="2" onClick="changeType(false);"/>不截取</div>
         <div style="widows:auto;float:left;margin-left:10px;display:inline;"><input type="submit" /></div>
    </div>
    </form>
    <script type="text/javascript">
    function changeType(jiequ)
    {
       var objSub=document.getElementById("sub");
       var objSub1=document.getElementById("sub1");
       if(jiequ)
       {
         objSub.style.display="none";
         objSub1.style.display="block";
       }
       else
       {
         objSub.style.display="block";
         objSub1.style.display="none";
       }
    }
    </script>
    </body>
    </html>