Просто тест - встроенный стиль vs глобальный
Сделал просто тест.
Так - работает:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test-2</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<script type="text/javascript">
var old_tr_id = 'r0';
function src_select(new_tr_id)
{
if (new_tr_id != 'r0')
{
document.getElementById(new_tr_id).style.display = "table-row";
}
if (old_tr_id != 'r0')
{
document.getElementById(old_tr_id).style.display = "none";
}
old_tr_id = new_tr_id;
}
</script>
</head>
<body>
<table>
<tr><td>Radio</td><td>
<input type=radio id=rb name=rb value='r1' onclick="src_select(this.value)">1
<input type=radio id=rb name=rb value='r2' onclick="src_select(this.value)">2
<input type=radio id=rb name=rb value='r3' onclick="src_select(this.value)">3
<input type=radio id=rb name=rb value='r0' onclick="src_select(this.value)" checked>0
</td></tr>
<tr id=r1 style="display: none;"><td>1</td></tr>
<tr id=r2 style="display: none;"><td>2</td></tr>
<tr id=r3 style="display: none;"><td>3</td></tr>
</table>
</body>
</html>
--------------------------------------
А так - не работает.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test-1</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css">
.inv
{
display: none;
}
</style>
<script type="text/javascript">
var old_tr_id = 'r0';
function src_select(new_tr_id)
{
if (new_tr_id != 'r0')
{
document.getElementById(new_tr_id).style.display = "table-row";
}
if (old_tr_id != 'r0')
{
document.getElementById(old_tr_id).style.display = "none";
}
old_tr_id = new_tr_id;
}
</script>
</head>
<body>
<table>
<tr><td>Radio</td><td>
<input type=radio id=rb name=rb value='r1' onclick="src_select(this.value)">1
<input type=radio id=rb name=rb value='r2' onclick="src_select(this.value)">2
<input type=radio id=rb name=rb value='r3' onclick="src_select(this.value)">3
<input type=radio id=rb name=rb value='r0' onclick="src_select(this.value)" checked>0
</td></tr>
<tr id=r1 class=inv><td>1</td></tr>
<tr id=r2 class=inv><td>2</td></tr>
<tr id=r3 class=inv><td>3</td></tr>
</table>
</body>
</html>
|