Mēģināju abas metodes, bet izskatās, ka kaut ko daru galīgi garām.. :(
<script type="text/javascript">
var teksti = ['teksts1','teksts2','teksts3','teksts4','teksts5'];
for(var i=1; i<4; i++)
{
document.GetElementBy('nosaukums_'+i).style.fontWeight = 'normal';
}
</script>
<div id="tekstiem"></div>
<a href="#" id="nosaukums_1" onclick="document.getElementById('tekstiem').innerHTML = teksti[0]; this.style.fontWeight = 'bold'; return false;">1</a>
<a href="#" id="nosaukums_2" onclick="document.getElementById('tekstiem').innerHTML = teksti[1]; this.style.fontWeight = 'bold'; return false;">2</a>
<a href="#" id="nosaukums_3" onclick="document.getElementById('tekstiem').innerHTML = teksti[2]; this.style.fontWeight = 'bold'; return false;">3</a>
Bolds uzliekās katram, bet nost neiet.
<script type="text/javascript">
var teksti = ['teksts1','teksts2','teksts3','teksts4','teksts5'];
var mans_bolds='a1';
function uz_bold(id)
{
document.GetElementBy(mans_bolds).style.fontWeight = 'normal';
document.GetElementBy(id).style.fontWeight = 'bold';
mans_bolds=id;
return false;
}
</script>
<div id="tekstiem"></div>
<a href="#" id="a1" onclick="document.getElementById('tekstiem').innerHTML = teksti[0]; uz_bold('a1'); return false;">1</a>
<a href="#" id="a2" onclick="document.getElementById('tekstiem').innerHTML = teksti[1]; uz_bold('a2'); return false;">2</a>
<a href="#" id="a3" onclick="document.getElementById('tekstiem').innerHTML = teksti[2]; uz_bold('a3'); return false;">3</a>
Bolds nepārādās vispār.
Vai varētu būt vainīgs JS skripta novietojums dokumentā?