[Javascript + PHP] Problème de quotes ?
sluggogle
-
titugo63 -
titugo63 -
Bonjour,
J'ai defini une variable avec une boucle while php :
//----------------------------------------------------
while ($data3 = mysql_fetch_array($go3))
{
$ce = $data3['ID_CE'];
}
//---------------------------------------------------
J'ai aussi une fonction en Javascript qui demande confirmation :
//--------------------------------------------------------
function confirmation(message,action)
{
if(confirm(message)) {eval(action);}
}
//--------------------------------------------------------
Un lien a faire en cas de confirmation :
//--------------------------------------------------------
$action = "window.location.href='index.php?page=traitement&categorie=2&action=1&id=".$ce."'"
//--------------------------------------------------------
Et finalement l'application du tout :
//-------------------------------------------------------
onClick="confirmation('Supprimer ?','<?php echo $action;?>')"
//-------------------------------------------------------
Je pense que mon soucis vient des quotes. A cause de la simple quote qui indique le debut du lien --> 'index.php ...'
A moins que les triples quotes existe il y a t'il une solution a mon problème ou alors une méthode complètement différente ?
Merci d'avance ^^
J'ai defini une variable avec une boucle while php :
//----------------------------------------------------
while ($data3 = mysql_fetch_array($go3))
{
$ce = $data3['ID_CE'];
}
//---------------------------------------------------
J'ai aussi une fonction en Javascript qui demande confirmation :
//--------------------------------------------------------
function confirmation(message,action)
{
if(confirm(message)) {eval(action);}
}
//--------------------------------------------------------
Un lien a faire en cas de confirmation :
//--------------------------------------------------------
$action = "window.location.href='index.php?page=traitement&categorie=2&action=1&id=".$ce."'"
//--------------------------------------------------------
Et finalement l'application du tout :
//-------------------------------------------------------
onClick="confirmation('Supprimer ?','<?php echo $action;?>')"
//-------------------------------------------------------
Je pense que mon soucis vient des quotes. A cause de la simple quote qui indique le debut du lien --> 'index.php ...'
A moins que les triples quotes existe il y a t'il une solution a mon problème ou alors une méthode complètement différente ?
Merci d'avance ^^
A voir également:
- [Javascript + PHP] Problème de quotes ?
- Easy php - Télécharger - Divers Web & Internet
- Telecharger javascript - Télécharger - Langages
- Expert php pinterest - Télécharger - Langages
- A javascript error occurred in the main process - Forum Windows
- A javaScript error occurred in the main process - Forum Handicap / Accessibilté
4 réponses
Je viens de regarder le message et je me suis apercu qu'il s'affiche mal :
le lien est bien :
$action = "window.location.href='index.php?page=traitement&categorie=2&action=1&id=".$ce. " ' "
le lien est bien :
$action = "window.location.href='index.php?page=traitement&categorie=2&action=1&id=".$ce. " ' "
Re,
bien j'ai trouver la solution.
Dans le lien : $action = "window.location.href='index.php?page=traitement&categorie=2&action=1&id=".$ce. " ' "
Il suffite de mettre un \ : $action = "window.location.href=\'index.php?page=traitement&categorie=2&action=1&id=".$ce. "\ ' "
voila pour ceux que ca peut aider
bien j'ai trouver la solution.
Dans le lien : $action = "window.location.href='index.php?page=traitement&categorie=2&action=1&id=".$ce. " ' "
Il suffite de mettre un \ : $action = "window.location.href=\'index.php?page=traitement&categorie=2&action=1&id=".$ce. "\ ' "
voila pour ceux que ca peut aider
ceci ne fontionne pas
document.getElementById('JavaSidebarPh').innerHTML = "<a href='#' onclick='document.getElementById(\'JavaMainContent\').innerHTML=\'<table><tr><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/images.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/imagesqsdfq.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/imagessdfsdf.jpg\\\'></td></tr></table>\''>2008-06-14</a><br><a href='#' onclick='document.getElementById(\'JavaMainContent\').innerHTML=\'<table><tr><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-10-19/images f.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-10-19/images.jpg\\\'></td></tr></table>\''>2008-10-19</a><br>";
et ceci ne fonctionne avec ie7 uniquement
document.getElementById('JavaSidebarPh').innerHTML = "<a href='#' onclick=`document.getElementById(\'JavaMainContent\').innerHTML=\'<table><tr><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/images.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/imagesqsdfq.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/imagessdfsdf.jpg\\\'></td></tr></table>\''>2008-06-14</a><br><a href='#' onclick='document.getElementById(\'JavaMainContent\').innerHTML=\'<table><tr><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-10-19/images f.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-10-19/images.jpg\\\'></td></tr></table>\'`>2008-10-19</a><br>";
document.getElementById('JavaSidebarPh').innerHTML = "<a href='#' onclick='document.getElementById(\'JavaMainContent\').innerHTML=\'<table><tr><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/images.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/imagesqsdfq.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/imagessdfsdf.jpg\\\'></td></tr></table>\''>2008-06-14</a><br><a href='#' onclick='document.getElementById(\'JavaMainContent\').innerHTML=\'<table><tr><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-10-19/images f.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-10-19/images.jpg\\\'></td></tr></table>\''>2008-10-19</a><br>";
et ceci ne fonctionne avec ie7 uniquement
document.getElementById('JavaSidebarPh').innerHTML = "<a href='#' onclick=`document.getElementById(\'JavaMainContent\').innerHTML=\'<table><tr><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/images.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/imagesqsdfq.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-06-14/imagessdfsdf.jpg\\\'></td></tr></table>\''>2008-06-14</a><br><a href='#' onclick='document.getElementById(\'JavaMainContent\').innerHTML=\'<table><tr><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-10-19/images f.jpg\\\'></td><td><img width=\\\'100px\\\' height=\\\'100px\\\' src=\\\'site/foot/pictures/2008-10-19/images.jpg\\\'></td></tr></table>\'`>2008-10-19</a><br>";