par
damaskinos » 17 juil. 2006, 16:42
Bon j'ai essayé ce que vous m'avez dis et la j'ai un truc bizarre.
Quand j'utilise ce code:
function envoyer(formulaire) {
var url = window.opener.location.toString();
var maReg = new RegExp( "[? ]", "gi") ;
var resultat = url.split(maReg);
if(formulaire.langue[0].checked)
{
//var maReg = new RegExp( , "gi") ;
var resul = url.replace(resultat[1],"langue=english");
window.opener.location = resul;
}
if(formulaire.langue[1].checked)
{
var resul = url.replace(resultat[1],"langue=français");
window.opener.location = resul;
}
if(formulaire.langue[2].checked)
{
alert(window.opener.location);
var resul = url.replace(resultat[1],"langue=german");
alert(window.opener.location);
window.opener.location = resul;
}
if(formulaire.langue[3].checked)
{
var resul = url.replace(resultat[1],"langue=italian");
window.opener.location = resul;
}
if(formulaire.langue[4].checked)
{
var resul = url.replace(resultat[1],"langue=spanish");
window.opener.location= resul;
}
alert(window.opener.location);
window.opener.location.reload();
window.close();
}
Ça fonction mais comme vous voyez j'ai des alert pour voir ce qui se passe. Dans les alert l'URL ne change jamais. Mais ma page se reload avec le bon URL.
Quand j'enleve les alert, Là ça ne fonctionne plus.

je ne comprend pas trop.
Ce code ne fonctionne pas.
function envoyer(formulaire) {
var url = window.opener.location.toString();
var maReg = new RegExp( "[? ]", "gi") ;
var resultat = url.split(maReg);
if(formulaire.langue[0].checked)
{
//var maReg = new RegExp( , "gi") ;
var resul = url.replace(resultat[1],"langue=english");
window.opener.location = resul;
}
if(formulaire.langue[1].checked)
{
var resul = url.replace(resultat[1],"langue=français");
window.opener.location = resul;
}
if(formulaire.langue[2].checked)
{
var resul = url.replace(resultat[1],"langue=german");
window.opener.location = resul;
}
if(formulaire.langue[3].checked)
{
var resul = url.replace(resultat[1],"langue=italian");
window.opener.location = resul;
}
if(formulaire.langue[4].checked)
{
var resul = url.replace(resultat[1],"langue=spanish");
window.opener.location= resul;
}
window.opener.location.reload();
window.close();
}
.
J'ai juste enlevé les alerts.
Bon j'ai essayé ce que vous m'avez dis et la j'ai un truc bizarre.
Quand j'utilise ce code:[php]
function envoyer(formulaire) {
var url = window.opener.location.toString();
var maReg = new RegExp( "[? ]", "gi") ;
var resultat = url.split(maReg);
if(formulaire.langue[0].checked)
{
//var maReg = new RegExp( , "gi") ;
var resul = url.replace(resultat[1],"langue=english");
window.opener.location = resul;
}
if(formulaire.langue[1].checked)
{
var resul = url.replace(resultat[1],"langue=français");
window.opener.location = resul;
}
if(formulaire.langue[2].checked)
{
alert(window.opener.location);
var resul = url.replace(resultat[1],"langue=german");
alert(window.opener.location);
window.opener.location = resul;
}
if(formulaire.langue[3].checked)
{
var resul = url.replace(resultat[1],"langue=italian");
window.opener.location = resul;
}
if(formulaire.langue[4].checked)
{
var resul = url.replace(resultat[1],"langue=spanish");
window.opener.location= resul;
}
alert(window.opener.location);
window.opener.location.reload();
window.close();
}[/php]
Ça fonction mais comme vous voyez j'ai des alert pour voir ce qui se passe. Dans les alert l'URL ne change jamais. Mais ma page se reload avec le bon URL.
Quand j'enleve les alert, Là ça ne fonctionne plus. :? je ne comprend pas trop.
Ce code ne fonctionne pas.
[php]
function envoyer(formulaire) {
var url = window.opener.location.toString();
var maReg = new RegExp( "[? ]", "gi") ;
var resultat = url.split(maReg);
if(formulaire.langue[0].checked)
{
//var maReg = new RegExp( , "gi") ;
var resul = url.replace(resultat[1],"langue=english");
window.opener.location = resul;
}
if(formulaire.langue[1].checked)
{
var resul = url.replace(resultat[1],"langue=français");
window.opener.location = resul;
}
if(formulaire.langue[2].checked)
{
var resul = url.replace(resultat[1],"langue=german");
window.opener.location = resul;
}
if(formulaire.langue[3].checked)
{
var resul = url.replace(resultat[1],"langue=italian");
window.opener.location = resul;
}
if(formulaire.langue[4].checked)
{
var resul = url.replace(resultat[1],"langue=spanish");
window.opener.location= resul;
}
window.opener.location.reload();
window.close();
}[/php].
J'ai juste enlevé les alerts.