<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>RadioButtonListText</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="RadioButtonListText.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE" value="dDwtMTQ2MTEwNDc7Oz5FWlfD7/18J3fhCTstDB28V2NE9Q==" /> <table id="RadioButtonList1" border="0" style="height:168px;width:168px;Z-INDEX: 101; LEFT: 248px; POSITION: absolute; TOP: 232px">
<tr>
<td><input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="1" /><label for="RadioButtonList1_0">text1</label></td>
</tr><tr>
<td><input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="2" /><label for="RadioButtonList1_1">text2</label></td>
</tr><tr>
<td><input id="RadioButtonList1_2" type="radio" name="RadioButtonList1" value="3" /><label for="RadioButtonList1_2">text3</label></td>
</tr>
</table>
<input type=button value="ceshi " onclick="showtext();">
</form>
</body>
</HTML>
<script language=javascript>
function showtext()
{//document.getElementsByTagName
var rbList=document.getElementById('RadioButtonList1');
var radios=rbList.getElementsByTagName("INPUT");
var strText='';
for(var i=radios.length-1;i>=0;i--)
{
strText+=radios[i].innerText;
}
alert(strText);
}
</script>
解决方案 »
- 正则表达式查找字符串之间的文本
- jquery获取html对象,是否可以获取某个文字为对象
- 请问如何优化一个大循环?
- 求遍历一个多选options的方法
- 改改js,怎样使得函数产生随机值在页面加载的时候显示在页面上?
- google流量统计代码中javascript的执行次序问题
- 看看这个奇怪的for循环
- 求一个JS菜单代码
- showModalDialog 刷新问题 期盼高人给以解答!!
- vb做的日历控件在网页上运行
- 原创高手请进 能追加一个onload吗
- Javascript截取HTML代码问题,还有一点问题没解决。请ice_berg16(寻梦的稻草人) ,wuxinlangman(无心之尘) 进来看看。
var rbList=document.getElementById('RadioButtonList1');
var radios=rbList.getElementsByTagName("LABEL");