Hello all!
Here is my problem code:
[CODE]<img id=”zname” src=”images/dr_eng.jpg” title=”english” alt=”english” [B]onclick=”toggleLang();”[/B]>
<div class=”butoni”>
<table id=”Table_01″ border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td>
<a href=”” target=”_self”> <!– dobaviam vruzkite –>
<img id=”but1″ src=”images/but1.gif” width=”98″ height=”16″ alt=”Retour au debut”></a></td>
<td>
<a href=”” target=”_self”>
<img id=”but2″ src=”images/but2.gif” width=”95″ height=”16″ alt=”A propos”></a></td>
<td>
<a href=”” target=”_self”>
<img id=”but3″ src=”images/but3.gif” width=”96″ height=”16″ alt=”Reportages”></a></td>
<td>
<a href=”” target=”_self”>
<img id=”but4″ src=”images/but4.gif” width=”96″ height=”16″ alt=””></a></td>
</tr>
</table>
</div>
…well, I’m a beginner :o. The images in the table are buttons(in french). By the function toggleLang(), the images are replaced with other .gif in english which have the same name and postfix “_eng”. Here is the JS code:
[CODE]
function toggleLang(){
var sastoianie=document.getElementById(“zname”);
var tek=sastoianie.title;
var str=”français”;
var obj_smiana=[‘but1′,’but2′,’but3’]; /*tuk se dobaviat dopulnitelni obekti (id) za smiana na ezika*/
var change_src=””;
var memo=””;
if(tek==”english”){
refresh_etiket:
sastoianie.src=”images/drapeau_francais.jpg”;
sastoianie.title=sastoianie.alt=str;
for(i=0;i<obj_smiana.length;i++){
change_src=document.getElementById(obj_smiana[i]).src;
memo=document.getElementById(obj_smiana[i]);
change_src=change_src.replace(obj_smiana[i],obj_smiana[i]+”_eng”);
memo.src=change_src;
}
}
else{
sastoianie.src=”images/drapeau_anglais.jpg”;
sastoianie.title=sastoianie.alt=”english”;
for(i=0;i<obj_smiana.length;i++){
change_src=document.getElementById(obj_smiana[i]).src;
memo=document.getElementById(obj_smiana[i]);
change_src=change_src.replace(“_eng”,””);
memo.src=change_src;
}
}
}
This happens as I expect but if the language is switched to english, and if for any reason the page is refreshed, it turns back to french ?.
The browser reads again by the page and there are placed the “french files”.
The problem seems clear but would you help me to solve it, please?