begin process at 2012 05 28 14:56:04
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Effets

 > UN SON AU PASSAGE DE LA SOURIS

UN SON AU PASSAGE DE LA SOURIS


 Information sur la source

Note :
Aucune note
Catégorie :Effets Classé sous :survol-image, son-image, clic-image Niveau :Débutant Date de création :30/03/2010 Vu / téléchargé :4 309 / 406

Auteur : Damocles67

Ecrire un message privé
Site perso
Commentaire sur cette source (2)
Ajouter un commentaire et/ou une note

 Description

Insérez un son, une musique au passage de la souris sur une image (onmouseover).
Le son s'arrête quand la souris sort de l'image (onmouseout).

Testé sous Internet Explorer et Chrome.



Source

  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  • <html xmlns="http://www.w3.org/1999/xhtml">
  • <head>
  • <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  • <title>Insertion du son</title>
  • <script>
  • function PlaySound(soundobj) {
  • var thissound=document.getElementById(soundobj);
  • thissound.Play();
  • };
  • function StopSound(soundobj) {
  • var thissound=document.getElementById(soundobj);
  • thissound.Stop();
  • }
  • </script>
  • </head>
  • <body>
  • <table width="685" border="0" align="center" cellpadding="0" cellspacing="0">
  • <tr>
  • <td width="17%" align="center" valign="top">
  • <a href="#"><img src="coucou.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound1')" onmouseout="StopSound('sound1')" /></a><embed src="coucou.wav" autostart=false width=0 height=0 id="sound1" enablejavascript="true"></td>
  • <td width="20%" align="center" valign="top">
  • <a href="#"><img src="fauvette.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound2')" onmouseout="StopSound('sound2')" /></a><embed src="fauvette.wav" autostart=false width=0 height=0 id="sound2" enablejavascript="true"></td>
  • <td width="16%" align="center" valign="top">
  • <a href="#"><img src="geai_bleu.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound3')" onmouseout="StopSound('sound3')" /></a><embed src="geai.wav" autostart=false width=0 height=0 id="sound3" enablejavascript="true"></td>
  • <td width="15%" align="center" valign="top">
  • <a href="#"><img src="chouette.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound4')" onmouseout="StopSound('sound4')" /></a><embed src="chouette.wav" autostart=false width=0 height=0 id="sound4" enablejavascript="true"></td>
  • <td width="15%" align="center" valign="top">
  • <a href="#"><img src="mesange.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound5')" onmouseout="StopSound('sound5')" /></a><embed src="mesange.wav" autostart=false width=0 height=0 id="sound5" enablejavascript="true"></td>
  • </tr>
  • <tr>
  • <td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Coucou</font></b></td>
  • <td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Fauvette</font></b></td>
  • <td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Geai bleu </font></b></td>
  • <td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Chouette</font></b></td>
  • <td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Mesange</font></b></td>
  • </tr>
  • </table>
  • </body>
  • </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Insertion du son</title>
<script>
function PlaySound(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Play();
};

function StopSound(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Stop();
}
</script>
</head>
<body>
<table width="685" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="17%" align="center" valign="top">
<a href="#"><img src="coucou.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound1')" onmouseout="StopSound('sound1')" /></a><embed src="coucou.wav" autostart=false width=0 height=0 id="sound1" enablejavascript="true"></td>
<td width="20%" align="center" valign="top">
<a href="#"><img src="fauvette.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound2')" onmouseout="StopSound('sound2')" /></a><embed src="fauvette.wav" autostart=false width=0 height=0 id="sound2" enablejavascript="true"></td>
<td width="16%" align="center" valign="top">
<a href="#"><img src="geai_bleu.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound3')" onmouseout="StopSound('sound3')" /></a><embed src="geai.wav" autostart=false width=0 height=0 id="sound3" enablejavascript="true"></td>
<td width="15%" align="center" valign="top">
<a href="#"><img src="chouette.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound4')" onmouseout="StopSound('sound4')" /></a><embed src="chouette.wav" autostart=false width=0 height=0 id="sound4" enablejavascript="true"></td>
<td width="15%" align="center" valign="top">
<a href="#"><img src="mesange.jpg" width="133" height="137" hspace="2" border="0" onmouseover="PlaySound('sound5')" onmouseout="StopSound('sound5')" /></a><embed src="mesange.wav" autostart=false width=0 height=0 id="sound5" enablejavascript="true"></td>
</tr>
<tr>
	<td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Coucou</font></b></td>
    <td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Fauvette</font></b></td>
    <td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Geai bleu </font></b></td>
    <td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Chouette</font></b></td>
    <td align="center" valign="top"><b><font color="#009900" size="2" face="Verdana, Arial, Helvetica, sans-serif">Mesange</font></b></td>
  </tr>
</table>
</body>
</html>

 Conclusion

Ce code a été adapté de :
http://www.phon.ucl.ac.uk/home/mark/audio/play.h tm.

où d'autres possibilités sont offertes.

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

UNE MUSIQUE SUR UNE IMAGE AU PASSAGE DE LA SOURIS (I.E.6 +)

 Sources de la même categorie

Source avec Zip Source avec une capture BOUTON ROTATIF par kazma
Source avec Zip Source avec une capture SHOWMAPAREA par phidelum
DHTML IE FILTRE DÉGRADÉ (OUTIL HTML POUR DÉVELOPPEUR) par internetdev
Source avec Zip ANIMATION DU TEXTE par brennal
Source avec Zip Source avec une capture EFFET RAYONS DU SOLEIL par tefa24600

Commentaires et avis

Commentaire de josicho le 21/06/2010 12:27:57

il tres bien merci

Commentaire de blackt96 le 02/07/2010 20:30:50

ouais mais mais moi jai un petit probleme, ou puis-je héberger ma musique?(j'ai cherché)

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

Photothèque

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,373 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales