Should be simple and clear, but I dont get what is wrong here. Simple javascript show/hide content. Tryed both display - block/none and visibility - show/hidden. Not working.. It works if all divs visibility named npctext_X are set to visible. but i need them to be hidden, becouse this will be used in as dialogues...
<script type="text/javascript">
function npcfunkc(karodyt,senas){
var showit = 'npctext_'+karodyt;
var hideit = 'npctext_'+senas
//document.getElementById(showit).style.display='block';
//document.getElementById(hideit).style.display='none';
document.getElementById(showit).style.visibility = 'show';
document.getElementById(hideit).style.visibility = 'hidden';
}
</script>
<div class='npctalk'>
<div id='npctext_1' style='visibility:visible;'>text 1 text 1 text 1 <br /><br />
<button onclick='npcfunkc(2,1)'>show 2 [hide 1]
</button><br />
<button onclick='npcfunkc(3,1)'>show 3 [hide 1]
</button><br />
</div>
<div id='npctext_2' style='visibility:hidden;'>text 2 text 2 text 2 <br /><br />
<button onclick='npcfunkc(1,2)'>show 1, [hide 2]
</button><br />
<button onclick='npcfunkc(3,2)'>show 3, [hide 2]
</button><br />
</div>
<div id='npctext_3' style='visibility:hidden;'>text 3 text 3 text 3 <br /><br />
<button onclick='npcfunkc(2,3)'>show 2, [hide 3]
</button><br />
<button onclick='npcfunkc(1,3)'>show 1, [hide 3]
</button><br />
</div>
</div>