<table border="1" width="100%" id='table1001' Leaguename="意甲">
</table>
<table border="1" width="100%" id='table1164' Leaguename="意甲">
</table>
<table border="1" width="100%" id='table1598' Leaguename="意甲">
</table>
<table border="1" width="100%" id='tabsdfle1598' Leaguename="意甲">
</table><SCRIPT LANGUAGE="JavaScript">
<!--
var tables = document.getElementsByTagName('TABLE');
for (var i = 0; i < tables.length; i++) {
if (tables[i].id.substring(0, 5) == 'table')
alert(tables[i].id);
}
//-->
</SCRIPT>
</table>
<table border="1" width="100%" id='table1164' Leaguename="意甲">
</table>
<table border="1" width="100%" id='table1598' Leaguename="意甲">
</table>
<table border="1" width="100%" id='tabsdfle1598' Leaguename="意甲">
</table><SCRIPT LANGUAGE="JavaScript">
<!--
var tables = document.getElementsByTagName('TABLE');
for (var i = 0; i < tables.length; i++) {
if (tables[i].id.substring(0, 5) == 'table')
alert(tables[i].id);
}
//-->
</SCRIPT>
害偶白写了<script>
var o=document.getElementsByTagName("table");
for(var i=0;i<o.length;i++)
if(o[i].id.substring(0,5)=="table")
alert(o[i].id.substring(5));
</script>
不行的
因为同一个web中还有很多别的 table
这个不错 顶了 接分
</table>
<table border="1" width="100%" id='table1164' Leaguename="英超">
</table>
<table border="1" width="100%" id='table1598' Leaguename="意甲">
</table><input type="check" onclick="javascript:hidden('意甲')">隐藏意甲hidden () {
把意甲对应的table全部hidden}
hidden() 函数 怎么把所有 Leaguename="意甲" 的table取出来呢?
<tr><td>意甲</td></tr>
</table>
<table border="1" width="100%" id='table1164' Leaguename="英超">
<tr><td>英超</td></tr>
</table>
<table border="1" width="100%" id='table1598' Leaguename="意甲">
<tr><td>意甲</td></tr>
</table>
<input type="checkbox" onclick="javascript:hidden(this,'意甲')">隐藏意甲<script>
function hidden(obj,str){
var o=document.getElementsByTagName("table");
for(var i=0;i<o.length;i++)
if(o[i].id.substring(0,5)=="table"&&o[i].Leaguename==str)
if(obj.checked)
o[i].style.display='none';
else
o[i].style.display='';
}
</script>