roberma
01-04-2003, 05:34 PM
I have the following strange problem with frames and onclick events.
I have defined the following javascript function :
function ReloadMenu(lg) {
if (lg == 'anglais') {location= "English/Menu.html"; alert ("Switching to pages in English");
window.location.reload();
}
else {location = '../Menu.html';
alert ("Switching to pages in French");
window.location.reload();
}
}
The function definition is contained in a file called ReloadMenu.js
In the Menu.html file, which defines a frame in a frameset, I have the following code:
in the head section:
<SCRIPT src="ReloadMenu.js"> </SCRIPT>
In the Body:
<A HREF="English/Accueil.html" TARGET="MainPage" onclick='ReloadMenu("anglais")'>
<IMG SRC="drapeaux_angl_amer.gif" BORDER=0 WIDTH=50 HEIGHT=50 ALT="Go to pages in English"></A>
In the English/Menu.html file:
<A HREF="../Accueil.html" TARGET="MainPage" onClick='ReloadMenu("french")'>
<IMG SRC="../drapeau_fr.gif" BORDER=0 WIDTH=50 HEIGHT=50 ALT="Vers les pages en Français">
It works but only if I put the calls to the alert method in the ReloadMenu function. If I remove these calls, the content of the Menu window in the frame is not reloaded.
Note also that during local tests (on the site on my local computer disk), there is no problem. The call to the alert method is not necessary. I only meet the problem when accessing the site via the Internet.
Who can explain what happens and maybe indicate a way to proceed nicer than the workaround using the call to the alert method.
Thanks
I have defined the following javascript function :
function ReloadMenu(lg) {
if (lg == 'anglais') {location= "English/Menu.html"; alert ("Switching to pages in English");
window.location.reload();
}
else {location = '../Menu.html';
alert ("Switching to pages in French");
window.location.reload();
}
}
The function definition is contained in a file called ReloadMenu.js
In the Menu.html file, which defines a frame in a frameset, I have the following code:
in the head section:
<SCRIPT src="ReloadMenu.js"> </SCRIPT>
In the Body:
<A HREF="English/Accueil.html" TARGET="MainPage" onclick='ReloadMenu("anglais")'>
<IMG SRC="drapeaux_angl_amer.gif" BORDER=0 WIDTH=50 HEIGHT=50 ALT="Go to pages in English"></A>
In the English/Menu.html file:
<A HREF="../Accueil.html" TARGET="MainPage" onClick='ReloadMenu("french")'>
<IMG SRC="../drapeau_fr.gif" BORDER=0 WIDTH=50 HEIGHT=50 ALT="Vers les pages en Français">
It works but only if I put the calls to the alert method in the ReloadMenu function. If I remove these calls, the content of the Menu window in the frame is not reloaded.
Note also that during local tests (on the site on my local computer disk), there is no problem. The call to the alert method is not necessary. I only meet the problem when accessing the site via the Internet.
Who can explain what happens and maybe indicate a way to proceed nicer than the workaround using the call to the alert method.
Thanks