<input type="radio" name="dz" id="radio" value="手动填写"/>手动填写<br><input type="radio" name="dz" id="radio1" value="1"/>动态生成1<br>
<input type="radio" name="dz" id="radio2" value="2"/>动态生成2<br>
<input type="radio" name="dz" id="radio3" value="3"/>动态生成3<br>
...根据数据库信息动态生成很多个radio,其中有一个radio是默认存在的 id="radio"当我选择 id="radio" 的时候,显示一个隐藏的<div> 在里面填写,选择其他radio <div>在隐藏
当我选择动态生成的radio ,取得我选的radio的值问题1:<div>隐藏和显示
    2:怎样取得动态生成的radio 的值(这里应该是用JS来写吧,用JS取到的值在ASP.NET里怎样得到) 

解决方案 »

  1.   


    <html>
    <head>
    <script type="text/javascript">
    function showDiv(obj){
    var _radios = document.getElementsByName('dz');
    for(var i = 0 ; i < _radios.length ; ++i){
    document.getElementById('d_' + _radios[i].id).style.display = 'none';
    }
    document.getElementById('d_' + obj.id).style.display = 'block';
    }
    </script>
    </head>
    <body>
    <form action="xxx" method="xxx">
    <input type="radio" name="dz" onclick="showDiv(this)" id="radio" value="手动填写"/>手动填写<br> 
    <input type="radio" name="dz" onclick="showDiv(this)" id="radio1" value="1"/>动态生成1<br>
    <input type="radio" name="dz" onclick="showDiv(this)" id="radio2" value="2"/>动态生成2<br>
    <input type="radio" name="dz" onclick="showDiv(this)" id="radio3" value="3"/>动态生成3<br>
    <input type="submit" value="提交"/>
    </form>
    <div>
    <div id="d_radio">手动填写对应的DIV</div>
    <div style="display:none" id="d_radio1">动态生成1对应的DIV</div>
    <div style="display:none" style="display:none" id="d_radio2">动态生成2对应的DIV</div>
    <div style="display:none" id="d_radio3">动态生成3对应的DIV</div>
    </div>
    </body>
    </html>
      

  2.   


    <html>
    <head>
    <script>
    var pageNo = 111;
    var pageSize =4
    var code = pageNo * pageSize;//得到该页的最大编码
    //下面对编码进行6位,不足高位补零
    for(var i=3; i >= 0; i--)
    {
       var instance = code - i;
       var strInstance = instance + "";
       var sixZore = "000000";
       if(strInstance.length < 6)
       {
          var value =  sixZore.substring(0,(6 - strInstance.length)) + strInstance;
          alert(value);
        }
    }
    </script>
    </head>

    <body>dddddddddd</body>

    </html>
      

  3.   

    sorry ,发错位置。
    此外lz的问题说的不太清楚,只能推测
    <html>
    <head>
    <script type="text/javascript" src="jquery.js"></script>
    <script>
    $().ready(function()
    {
      
    $("#radio").change(function()
    {
    $("#test").show();
    });

    $("#radio").attr("checked","checked");

    $("#radio1").change(function()
    {
    $("#test").hide();
    });

    $("#radio2").change(function()
    {
    $("#test").hide();
    });

    $("#radio3").change(function()
    {
    $("#test").hide();
    });

    });
    </script>
    </head>

    <body>
    <input id="test">
    <input type="radio" name="dz" id="radio" value="手动填写"/>手动填写<br>
        <input type="radio" name="dz" id="radio1" value="1"/>动态生成1<br>
    <input type="radio" name="dz" id="radio2" value="2"/>动态生成2<br>
    <input type="radio" name="dz" id="radio3" value="3"/>动态生成3<br>
    </body>

    </html>