Javascript
afterload
-
__construct -
__construct -
Bonjour j'ai un problème dans un script php.
Alors j'ai un script php :
<?php
$date = date("ymd");
$heure = date("His");
$variable = mt_rand(1,400);
if ($variable==1)
{
echo'
<script language="javascript">
if(mmjsCountryCode == "FR"){
// display the banner for users in France
document.write('<iframe src="" width="300" height="250" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>');
} else {
// display a default banner
document.write('<img sr="path-to-your-default-banner">');
}
</script>
';
}
else
{
echo'
<script language="javascript">
if(mmjsCountryCode == "UK"){
// display the banner for users in UK
document.write('<iframe src="" width="300" height="250" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>');
} else {
// display a default banner
document.write('<img sr="path-to-your-default-banner">');
}
</script>
';
}
?>
Alors j'ai un script php :
<?php
$date = date("ymd");
$heure = date("His");
$variable = mt_rand(1,400);
if ($variable==1)
{
echo'
<script language="javascript">
if(mmjsCountryCode == "FR"){
// display the banner for users in France
document.write('<iframe src="" width="300" height="250" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>');
} else {
// display a default banner
document.write('<img sr="path-to-your-default-banner">');
}
</script>
';
}
else
{
echo'
<script language="javascript">
if(mmjsCountryCode == "UK"){
// display the banner for users in UK
document.write('<iframe src="" width="300" height="250" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>');
} else {
// display a default banner
document.write('<img sr="path-to-your-default-banner">');
}
</script>
';
}
?>
A voir également:
- Javascript
- Telecharger javascript pour pc - Télécharger - Langages
- Afficher un tableau javascript en html ✓ - Forum Javascript
- Javascript arrondi ✓ - Forum Windows
- Javascript arrondir à 2 décimales - Forum Webmastering
- Javascript void 0 c'est quoi ✓ - Forum Réseaux sociaux
3 réponses
Salut,
Est-ce qu'on pourrait savoir qu'elle est le problème que tu rencontres ?
Car c'est bien essayer de trouver ce qui cloche dans du code, mais ça peut être très long voir impossible si on ne sait pas quoi chercher.
@++ : -)
Est-ce qu'on pourrait savoir qu'elle est le problème que tu rencontres ?
Car c'est bien essayer de trouver ce qui cloche dans du code, mais ça peut être très long voir impossible si on ne sait pas quoi chercher.
@++ : -)
-----------------------------------------------------------------------------------------------------------------------------
le script dans le echo ne s"execute pas et ça fait bugger la page
-----------------------------------------------------------------------------------------------------------------------------
Le script ne s'exécute pas dans la condition if PHP ou dans le else PHP ?
De plus ton script javascript crée 2 iframes identiques dont la source n'est pas indiquée dans la 1ère condition et une même image dont la source n'est pas indiquée également dans la 2ème condition.
Teste ainsi car je ne vois pas trop où se situe ton problème, tu ne développes pas assez tes réponses :
le script dans le echo ne s"execute pas et ça fait bugger la page
-----------------------------------------------------------------------------------------------------------------------------
Le script ne s'exécute pas dans la condition if PHP ou dans le else PHP ?
De plus ton script javascript crée 2 iframes identiques dont la source n'est pas indiquée dans la 1ère condition et une même image dont la source n'est pas indiquée également dans la 2ème condition.
Teste ainsi car je ne vois pas trop où se situe ton problème, tu ne développes pas assez tes réponses :
<?php
$date = date("ymd");
$heure = date("His");
$variable = mt_rand(1,400);
if($variable==1) { ?>
<script language="javascript">
if(mmjsCountryCode == "FR") {
// display the banner for users in France
document.write('<iframe src="" width="300" height="250" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>');
} else {
// display a default banner
document.write('<img src="path-to-your-default-banner">');
}
</script>
<?php } else { ?>
<script language="javascript">
if(mmjsCountryCode == "UK") {
// display the banner for users in UK
document.write('<iframe src="" width="300" height="250" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>');
} else {
// display a default banner
document.write('<img src="path-to-your-default-banner">');
}
</script>
<?php } ?>