我期待着根据另一个DIV的具体案文隐藏一些DIV。 我的贾瓦特(以下)是徒劳的。
<><><><><>>><>>>>>
<div id="LEGEND">abAB</div>
<div id="small-a"></div>
<div id="small-b"></div>
<div id="big-a"></div>
<div id="big-b"></div>
If the LEGEND DIV contains the text a, then I want it to show only DIV small-a.
If the LEGEND DIV contains the text bA, then I want it to show only DIV small-b and big-a.
www.un.org/Depts/DGACM/index_spanish.htm The Javascript:
<script>
window.onload = function ShowHide{
if (document.getElementById( LEGEND ).indexOf("a") > 0){
document.getElementById( small-a ).style.display = block ;}
if (document.getElementById( LEGEND ).indexOf("b") > 0){
document.getElementById( small-b ).style.display = block ;}
if (document.getElementById( LEGEND ).indexOf("A") > 0){
document.getElementById( big-a ).style.display = block ;}
if (document.getElementById( LEGEND ).indexOf("a") > 0){
document.getElementById( big-b ).style.display = block ;}
</script>