Is there a simpler, more elegant way to specify what is shown and what is
hidden than the following primitive script?
<script type="text/javascript">
var pN = new Array();
pN["1"]="Text 1.";
pN["2"]="Text 2";
pN["3"]="Text 3";
pN["4"]=""Text 4";
pN["5"]="Text 5";
pN["6"]="Text 6";
function showPHelp(n) {
document.getEle mentById('pSpot ').innerHTML = pN[n];
show('test1');
//The following is what I want to improve on
if (n==1) {show('image1') ;hide('image2') ;}
else if (n==2) {hide('image1') ;show('image2') ;}
..
..
else if (n==6)
{show('image6') ;hide('image1') ;hide('image2') ;......;hide('i mage5');}
}
<body>
<div id="test1" style="display: none;"><span id="pSpot"></span>
<div id="image1" style="display: none;"><img src='p1.jpg'... ></div>
<div id="image2" style="display: none;"><img src='p2.jpg'... ></div>
...
...
<div id="image62" style="display: none;"><img src='p6.jpg'... ></div>
<a name="" onclick="hide(' test1');">Close </a>
</div>
<br><br>
<a name="" onclick="showPH elp(1);">?1</a>
<br><br>
<a name="" onclick="showPH elp(2);">?2</a>
...
...
<a name="" onclick="showPH elp(6);">?6</a>
Thank you,
Herb