问题描述
- 问题是这样的 我要从后台获取asp:RadioButton 是否被选中
-
<script type="text/javascript"> function selectSingleRadio(rbtn) { var radio = document.getElementsByTagName("radio"); var arrAll = document.all; for (i = 0; i < arrAll.length; i++) { if (arrAll[i].type == "radio") { arrAll[i].checked = true; } } rbtn.checked = false; console.log(rbtn.checked); } </script> </section> <div style="background-color: red; padding-top:70xp"> <div style="float: right; margin-right: 100px; margin-top: 30px;"> <a data-toggle="modal" data-target="#Signup" href="#"><font style="font-size: 24px;">新建</font></a><font style="font-size: 24px;">丨 <a data-toggle="modal" data-target="#Signup" href="#"><font style="font-size: 24px;">上传</font></a>丨 <a href="#"><font style="font-size: 24px;"> <asp:Button ID="Button2" runat="server" Text="删 除" OnClick="Button2_Click" /> </font></a></font> </div> </div> <div style="float: left; margin-left: 20%;margin-right: 10%; margin-top: 10px; "> <div class="row"> <asp:Repeater ID="Modertuiji" runat="server"> <ItemTemplate> <div class="col-md-4 col-sm-6 col-xs-12" > <div class="thumbnail"> <table style=" font-family: '微软雅黑'; text-align: center; margin: auto 0;"> <tr> <asp:RadioButton runat="server" ID="rdo1" HidText='<%#Eval("FileName") %>' onclick="selectSingleRadio(this);" /> <td style="width:250px;"><a href="#"><img height="120" width="130" class ="" style="height:120px;width:130px" src="<%#Eval("ImgPath") %>"/></a></td> <td><br /></td> </tr> <tr style="font: '微软雅黑'; font-size: 24px;"> <td style="width: 250px;"><font><%#Eval("FileName") %></font> </td> </tr> </table> </div> </div> </div> </div> </div> </div>--%> </ItemTemplate> </asp:Repeater> </div> </div>
解决方案
没有radio这种标签,是input
var radio = document.getElementsByTagName("input");
时间: 2024-10-19 01:36:38