表格问题?急,在线等
数组如下:
php语言实现
$cases = array(
array("<input type=radio name=choose display:'none'>","102","female","shenyang","heart","heart illness ","CT","sick","end"),
array("<input type=radio name=choose>", "145","female","anshan","brain","brain illness","CT","well","end"),
array("<input type=radio name=choose>","234","male","fushun","leg","leg illness","CT","sick","end"),
array("<input type=radio name=choose>","432","female","tieling","arm","arm illness","CT","sick","end"),
array("<input type=radio name=choose>","678","male","faku","foot","foot illness","CT","well","end"),
array("<input type=radio name=choose>","112","female","dalian","arm","arm illness","CT","sick","end"),
array("<input type=radio name=choose>","256","female","shenyang","leg","leg illness","CT","well","end"),
array("<input type=radio name=choose>","985","male","huludao","brain","brain illness","CT","sick","end"),
array("<input type=radio name=choose>","568","male","liaoyang","heart","heart illness","CT","well","end"),
array("<input type=radio name=choose>","409","female","tieling","heart","heart illness","CT","well","end")
);
我的表格单击某行实现颜色的改变,我已经实现。里面有个td项为radio,现在想把radio项隐藏,通过单击某行实现该行对应的radio项被选中,并通过一个button实现该行信息的显示,想问下如何实现?谢谢:)
------解决方案--------------------HTML code
<style>
.hide{display:none;}
</style>
<script>
dodo.selected=null;
function dodo(tr){
var rs=tr.getElementsByTagName("input");
if(rs.length==0)return;
rs[0].checked=true;
rs[0].className='';
if(rs[0]!=dodo.selected&&dodo.selected!=null)dodo.selected.className="hide";
dodo.selected=rs[0];
}
function show(){
var rows=document.getElementById("tab").rows;
for(var i=0;i<rows.length;i++){
var rs=rows[i].getElementsByTagName("input");
if(rs.length==0)continue;
if(rs[0].checked){
alert(rows[i].innerHTML);//不知道你要显示这一行的什么信息
break;
}
}
}
</script>
<table id="tab">
<tr onclick="dodo(this)"><td><input type=radio name=choose class="hide" ></td><td>1111</td><tr>
<tr onclick="dodo(this)"><td><input type=radio name=choose class="hide" ></td><td>2222</td><tr>
<tr onclick="dodo(this)"><td><input type=radio name=choose class="hide" ></td><td>3333</td><tr>
</table>
<input type="button" value="显示选中行信息" onclick="show()" />
------解决方案--------------------
HTML code
<html >
<head >
<met