11548 sujets

JavaScript, DOM et API Web HTML5

salut,

cette page (voir ici) a un système de notation simple, joli, et fonctionnel.

Je débute en JS, et j'avoue ne pas bien comprendre le script vu avec firebug.

Merci aux bons samaritains de s'arrêter ici quelques minutes, le sujet me parait intéressant !

HTML
<tbody>
<tr>
<td class="description" style="color: rgb(68, 68, 68);">Note :</td>
<td class="description" align="right" style="color: rgb(68, 68, 68);">3/5 </td>
<td align="right" width="80">
<img height="16" width="16" src="/world/edito/im/note.jpg"/>
<img height="16" width="16" src="/world/edito/im/note.jpg"/>
<img height="16" width="16" src="/world/edito/im/note.jpg"/>
<img height="16" width="16" src="/world/edito/im/noteOff.jpg"/>
<img height="16" width="16" src="/world/edito/im/noteOff.jpg"/>
</td>
</tr>
<form method="post" action="/news/gastronomie/note.html" name="af_news_noteForm" style="margin: 0px; padding: 0px;"/>
<input type="hidden" value="8299" name="b"/>
<input type="hidden" name="n"/>
<script language="JavaScript">
1function af_news_noteShow(o,v) {for (i=1;i<=5;i++) o.parentNode.childNodes[i-1].src='/world/edito/im/note'+(i>v ? 'Off' : '')+'.jpg';o.parentNode.previousSibling.innerHTML=(v==0?'':v+'/5')+'&nbsp;';}function af_news_noteSave(v) {document.af_news_noteForm.n.value=v;document.af_news_noteForm.submit();}
</script>
<tr>
<td class="description" style="color: rgb(68, 68, 68);">Notez cette news :</td>
<td class="description" style="color: rgb(68, 68, 68);"> </td>
<td align="right" width="80">
<img height="16" width="16" onmouseout="af_news_noteShow(this,0);" onmouseover="af_news_noteShow(this,1);" onclick="af_news_noteSave(1);" style="cursor: pointer;" src="/world/edito/im/noteOff.jpg"/>
<img height="16" width="16" onmouseout="af_news_noteShow(this,0);" onmouseover="af_news_noteShow(this,2);" onclick="af_news_noteSave(2);" style="cursor: pointer;" src="/world/edito/im/noteOff.jpg"/>
<img height="16" width="16" onmouseout="af_news_noteShow(this,0);" onmouseover="af_news_noteShow(this,3);" onclick="af_news_noteSave(3);" style="cursor: pointer;" src="/world/edito/im/noteOff.jpg"/>
<img height="16" width="16" onmouseout="af_news_noteShow(this,0);" onmouseover="af_news_noteShow(this,4);" onclick="af_news_noteSave(4);" style="cursor: pointer;" src="/world/edito/im/noteOff.jpg"/>
<img height="16" width="16" onmouseout="af_news_noteShow(this,0);" onmouseover="af_news_noteShow(this,5);" onclick="af_news_noteSave(5);" style="cursor: pointer;" src="/world/edito/im/noteOff.jpg"/>
</td>
</tr>
</tbody>


les note.jpg sont les étoiles
Modifié par vjbeng (26 Jun 2008 - 20:30)
pas une petite idée sur la marche à suivre ?

si il existe un tuto bien fait sur un système de notation différent, je suis preneur !

merci
Adrien
Merci ! Ce script a l'air top !

l'instalaltion a l'air plus compliquée, par contre... affaire à suivre.
effectivement... je prends tout le temps le message d'erreur :


Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-gastronomiecom2.ratings WHERE id='id21'' at line 1



ma table se nomme "club-gastronomiecom2" ...est ce le tiret qui peut poser problème Heyoan ?
Modifié par vjbeng (26 Jun 2008 - 00:51)
vjbeng a écrit :
ma table se nomme "club-gastronomiecom2" ...est ce le tiret qui peut poser problème Heyoan ?
Oui Smiley cligne !

PS ! tu voulais dire ma database je suppose...
vjbeng a écrit :

si il existe un tuto bien fait sur un système de notation différent, je suis preneur !


J'ai bien un truc assez simple 99% CSS (même 100% si tu te moques de contrôler l'unicité des votes), tu peux en voir le principe ici :
http://forum.alsacreations.com/topic.php?fid=4&tid=35333&s=

(Même que c'est grâce à Heyoan si il fonctionne)

Mais bon, c'est loin d'être un tuto évidemment.

Nota @admins : Si cela intéresse AlsaCréationS, je veux bien en faire un tuto.
oula quel balourd je fais...

Acoswt, je t'ai répondu sur ton topic initial. En fait, mon souci, c'est plus le JS et le PHP... et ca pourrait surement intéresser qqun d'autre !

Merci
Adrien
Salut,

concernant le problème de tiret je viens de faire un test avec
	//Connect to  your rating database
	$rating_dbhost        = 'localhost';
	$rating_dbuser        = 'root';
	$rating_dbpass        = '';
	$rating_dbname        = '`club-gastronomiecom2`';
	$rating_tableName     = 'ratings';
qui fonctionne Smiley cligne
merci Heyoan,

mais je ne comprends pas trop la nature du test...
est ce que mon problème pourrait venir de l'hébergeur (infomaniak, tres bien jusqu'a maintenant), ou de la version de mysql ?
vjbeng a écrit :
mais je ne comprends pas trop la nature du test...

Arf ! Ce n'était pas très clair Smiley lol !

Ce que je voulais dire c'est qu'il suffisait de rajouter des ` autour de club-gastronomiecom2 pour ne plus avoir ton erreur mysql.

En plus clair :
$rating_dbname        = '[b][#blue]`[/#][/b]club-gastronomiecom2[b][#blue]`[/#][/b]';
ENOOOOOOORME !!!!!

Smiley biggol Smiley eek Smiley lol Smiley biggrin Smiley biggol Smiley ohwell Smiley biggol Smiley biggol Smiley confus Smiley biggol Smiley confus Smiley biggol Smiley biggol Smiley biggol Smiley biggol Smiley biggol Smiley confus Smiley biggol Smiley biggol Smiley biggol Smiley biggol Smiley biggol Smiley biggol Smiley biggol Smiley biggol Smiley confus Smiley biggol Smiley biggol Smiley biggol Smiley biggol

Merci Heyoan !!!

Testez ce script, gratuit, il est vraiment top !
Modifié par vjbeng (26 Jun 2008 - 20:28)