-
Problème de syntaxe
Bonjour à tous. J'ai un formulaire avec un input type="image".
Lors d'un click, je souhaiterai appeler une fonction javascript, mais visiblement, je doit avoir une grosse erreur de syntaxe :oops:
Code:
onClick="go('GET', 'affichage_news.php', 'tableau_news', 'type=add&titre_news='+new String(window.document.forms["saisie_news"].titre.value)+'&contenu_news='+new String(window.document.forms["saisie_news"].contenu.value)+')">
Si vous aviez des idées ....
Merci d'avance.
-
le type image est un bouton de type submit.
-> mets ton script dans le onSubmit du formulaire.
-
C'est fait :-)
Mais ca ne change pas grand chose à mon problème :roll:
-
remplace tes " par des \" dans ta chaine!
-
oui, ou met des '.
Il te manque aussi une parenthese à la fin :
Code:
onclick="go('GET', 'affichage_news.php', 'tableau_news', 'type=add&titre_news='+new String(window.document.forms['saisie_news'].titre.value)+'&contenu_news='+new String(window.document.forms['saisie_news'].contenu.value)+')');"
-
Bon, après m'être battu un peu avec, ca donne ca et ca marche :twisted:
Code:
onClick="go('GET', 'affichage_news.php', 'tableau_news', 'type=add&titre_news='+new String(window.document.forms['saisie_news'].titre.value)+'&contenu_news='+new String(window.document.forms['saisie_news'].contenu.value)+'\'');">
Merci de ton aide :-)