le htm bloque mon code javascript
Bonjour le forum,
J'ai un souci concernant un mini forum que je mets sur un intranet.
Mon code fonctionne tr�s bien tant que je ne mets pas une balise <a></a> dedans :
Voici le code, si vous avez, s'il vous plait, une petite aide � me donner :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
<head>
<style type="text/css">
.menu ul {cursor:pointer;}
.menu ul ul {display:none;color:red;}
.menu ul ul ul {display:none;color:green;}
</style>
<script type="text/javascript">
function showhide(menu) {
event.cancelBubble=true;
menuStyle=menu.childNodes[1].style;
menuStyle.display=(menuStyle.display=="block")? "none" : "block";
}
</script>
</head>
<body>
<?
$conn = mysql_connect('', '', '');$db = mysql_select_db('dossiers', $conn);
echo "<hr>Avec les images dans le <li....><hr>";
echo '<div class="menu"><ul>';
$forum = mysql_query("SELECT * FROM partF order by titre ASC");
while($listF = mysql_fetch_assoc($forum))
{
$F_id = $listF['forum_id'];
$F_t = $listF['titre'];
$F_tx = $listF['texte'];
echo '<li onClick="showhide(this)">'.$F_t.'<ul>';
$topic = mysql_query("SELECT * FROM partT where forum_id='$F_id' order by titre ASC");
$nb=mysql_num_rows($topic);
// echo 'NB : '.$nb.'<br>';
while($listT = mysql_fetch_assoc($topic))
{
$T_id = $listT['topic_id'];
$T_t = $listT['titre'];
$T_tx = $listT['texte'];
$T_d = $listT['date'];
echo '<br><li onClick="showhide(this)">['.$T_t.'] : '.$T_tx.' ('.$T_d.')';
echo '<a href="question.php"><img src="images/question.gif" border="0" width="15" height="15"></a>';
echo '<ul><br>';
$post = mysql_query("SELECT * FROM partP where forum_id='$F_id' and topic_id='$T_id'");
while($listP = mysql_fetch_assoc($post))
{
$P_id = $listP['post_id'];
$P_d = $listP['date'];
$P_tx = $listP['texte'];
echo '<li>'.$P_tx.' ('.$P_d.')</li><a href="question.php"><img src="images/question.gif" border="0" width="15" height="15"></a>';
}
echo '</ul></li>';
}
echo '</ul></li>';
}
echo '</ul></div>'; |
Sans les images, �a fonctionne tr�s bien..
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
<head>
<style type="text/css">
.menu ul {cursor:pointer;}
.menu ul ul {display:none;color:red;}
.menu ul ul ul {display:none;color:green;}
</style>
<script type="text/javascript">
function showhide(menu) {
event.cancelBubble=true;
menuStyle=menu.childNodes[1].style;
menuStyle.display=(menuStyle.display=="block")? "none" : "block";
}
</script>
</head>
<body>
<?
$conn = mysql_connect('', '', '');$db = mysql_select_db('dossiers', $conn);
echo "<hr>Sans les images dans le <li....><hr>";
echo '<div class="menu"><ul>';
$forum = mysql_query("SELECT * FROM partF order by titre ASC");
while($listF = mysql_fetch_assoc($forum))
{
$F_id = $listF['forum_id'];
$F_t = $listF['titre'];
$F_tx = $listF['texte'];
echo '<li onClick="showhide(this)">'.$F_t.'<ul>';
$topic = mysql_query("SELECT * FROM partT where forum_id='$F_id' order by titre ASC");
$nb=mysql_num_rows($topic);
// echo 'NB : '.$nb.'<br>';
while($listT = mysql_fetch_assoc($topic))
{
$T_id = $listT['topic_id'];
$T_t = $listT['titre'];
$T_tx = $listT['texte'];
$T_d = $listT['date'];
echo '<br><li onClick="showhide(this)">['.$T_t.'] : '.$T_tx.' ('.$T_d.')';
echo '<ul><br>';
$post = mysql_query("SELECT * FROM partP where forum_id='$F_id' and topic_id='$T_id'");
while($listP = mysql_fetch_assoc($post))
{
$P_id = $listP['post_id'];
$P_d = $listP['date'];
$P_tx = $listP['texte'];
echo '<li>'.$P_tx.' ('.$P_d.')</li>';
}
echo '</ul></li>';
}
echo '</ul></li>';
}
echo '</ul></div>';
?>
</body> |
l'execution du script se trouve ici : http://www.test-internet.com/testforum1.php
Je pr�cise que l'image me permetra d'ouvrir une boite de idalogue pour laisser une question ou une r�ponse, donc importante, mais pour l'intsant sa pr�snece m'empeche l'affichage de la r�ponse.
Merci beaucoup du temps que vous disposerez a me donner