<script type="text/javascript">
function display(id) {
$("html *").attr('id')
var sub=id.substring(0,1);
if(sub) {
document.getElementById(id).style.visibility="visible";
} else {
document.getElementById(id).style.visibility="hidden";
}
}
</script>
答案 0 :(得分:0)
使用jQuery,选择具有属性id
的元素,并使用each
方法对其进行迭代。例如:
$('[id]').each(function() {
console.log(this.getAttribute('id'));
});
答案 1 :(得分:0)
function check(id)
{
var s = id.substring(0,1);
var tableCells = document.getElementsByTagName('td'),
cellCount = tableCells.length,i;
for (i = 0; i < cellCount; i += 1) {
var sub = tableCells.substring(0,1);
if(strcmp(s,sub)) {
document.getElementById(id).style.visibility="visible";
}
else {
document.getElementById(id).style.visibility="hidden";
}
}
}
答案 2 :(得分:0)
功能检查(id)
{
var sub = id.substring(0,1);
IOBase
}