|
|
|
|
Bonjour,
J'ai créer une page web qui contient du javascript et du PHP. J'ai enregistrer cette page sous forme page.php . Le problème, c'est que lorsque je lance le navigateur, il me lance un un parse error à la ligne 18 qui correspond à ma balise insérant le javascript : <script>
Je me demande si c'est une mauvaise balise que j'ai mis ou bien si il faut l'enregistrer sous une autre extension.
Merci de votre aide !
T'as un problème ? Passe sur CCM !
_.-~°1000trad°~-._Configuration: Windows XP Home & Linux Ubuntu 8.10
<br />512 RAM, 1Ghz. 80 Go HDD
<br />Mozilla Firefox 3.0.7
<br />
<br />
<br />
Merci à tous, voici le code : j'ai mis les balises javascript en gras.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > <head> <?php if($balises) { <script language="Javascript"> function bbcode(bbdebut, bbfin) { var input = window.document.formulaire.message; input.focus(); if(typeof document.selection != 'undefined') { var range = document.selection.createRange(); var insText = range.text; range.text = bbdebut + insText + bbfin; range = document.selection.createRange(); if (insText.length == 0) { range.move('character', -bbfin.length); } else { range.moveStart('character', bbdebut.length + insText.length + bbfin.length); } range.select(); } else if(typeof input.selectionStart != 'undefined') { var start = input.selectionStart; var end = input.selectionEnd; var insText = input.value.substring(start, end); input.value = input.value.substr(0, start) + bbdebut + insText + bbfin + input.value.substr(end); var pos; if (insText.length == 0) { pos = start + bbdebut.length; } else { pos = start + bbdebut.length + insText.length + bbfin.length; } input.selectionStart = pos; input.selectionEnd = pos; } else { var pos; var re = new RegExp('^[0-9]{0,3}$'); while(!re.test(pos)) { pos = prompt("insertion (0.." + input.value.length + "):", "0"); } if(pos > input.value.length) { pos = input.value.length; } var insText = prompt("Veuillez taper le texte"); input.value = input.value.substr(0, pos) + bbdebut + insText + bbfin + input.value.substr(pos); } } function smilies(img) { window.document.formulaire.message.value += '' + img + ''; } </script> } ?> <?php if (!empty($titre)) //Si le titre est indiqué, on l'affiche entre les balises <title> { echo '<title> '.$titre.' </title>'; } else //Sinon, on écrit forum par défaut { echo '<title> Forum </title>'; } ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> </html>T'as un problème ? Passe sur CCM ! _.-~°1000trad°~-._ |
C'est bien ce que je pensait, tu n'as pas mis le tag de fin de php pour mettre la partie javascript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > <head> <?php if($balises){ //le tag de fin de php manquait là ?> <script language="Javascript"> function bbcode(bbdebut, bbfin) { var input = window.document.formulaire.message; input.focus(); if(typeof document.selection != 'undefined') { var range = document.selection.createRange(); var insText = range.text; range.text = bbdebut + insText + bbfin; range = document.selection.createRange(); if (insText.length == 0) { range.move('character', -bbfin.length); } else { range.moveStart('character', bbdebut.length + insText.length + bbfin.length); } range.select(); } else if(typeof input.selectionStart != 'undefined') { var start = input.selectionStart; var end = input.selectionEnd; var insText = input.value.substring(start, end); input.value = input.value.substr(0, start) + bbdebut + insText + bbfin + input.value.substr(end); var pos; if (insText.length == 0) { pos = start + bbdebut.length; } else { pos = start + bbdebut.length + insText.length + bbfin.length; } input.selectionStart = pos; input.selectionEnd = pos; } else { var pos; var re = new RegExp('^[0-9]{0,3}$'); while(!re.test(pos)) { pos = prompt("insertion (0.." + input.value.length + "):", "0"); } if(pos > input.value.length) { pos = input.value.length; } var insText = prompt("Veuillez taper le texte"); input.value = input.value.substr(0, pos) + bbdebut + insText + bbfin + input.value.substr(pos); } } function smilies(img) { window.document.formulaire.message.value += '' + img + ''; } </script> <?php //ici aussi il y avait une petite erreur } if (!empty($titre)) //Si le titre est indiqué, on l'affiche entre les balises <title> { echo '<title> '.$titre.' </title>'; } else //Sinon, on écrit forum par défaut { echo '<title> Forum </title>'; } ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> </html>
|