Attribuer un son a une alert (js)
Chabanus
Messages postés
1026
Statut
Membre
-
Chabanus Messages postés 1026 Statut Membre -
Chabanus Messages postés 1026 Statut Membre -
Bonsoir,
J'aimerais s'il vous plait que vous me donniez le code en php ou js qui permettra d'entendre un son lors de l'affichage de l'alert, merci
J'aimerais s'il vous plait que vous me donniez le code en php ou js qui permettra d'entendre un son lors de l'affichage de l'alert, merci
<script language="javascript">
function interdit()
{
alert('Vous devez être connecté !');
}
</script>
A voir également:
- Attribuer un son a une alert (js)
- Comment attribuer une sonnerie à un contact - Guide
- Faire croire que son numero n'est plus attribué - Forum Réseaux sociaux
- Attribuer une valeur à une cellule texte excel - Forum Excel
- Round js ✓ - Forum Javascript
- Php alert ✓ - Forum PHP
3 réponses
Merci pour ta réponse, mais avec google il faut placer les bons mots clés et les miens n'ont pas trop fonctionner, sinon voici ce que j'ai trouvé mais pour un son sur une page, comment l'intégrer a une alerte, aucune idée:
Cordialement
<?php
$repertoire='./midi/';
$compteur=0;
$handle=opendir($repertoire);
while ($fichier = readdir($handle))
{
if (strlen($fichier)>3)
{$extension= strtolower(substr( strrchr( $fichier, "." ), 1 ));
if ($extension=="mid")
{ $compteur++;
$fichmidi[$compteur]=$fichier;
}
}
}
closedir($handle);
if ($compteur>0)
{srand((double)microtime()*1000000);
$aleatoire=rand(1,$compteur);
if (ereg("MSIE", $HTTP_USER_AGENT))
{
echo "<bgsound src='$repertoire$fichmidi[$aleatoire]' LOOP=INFINITE>";}
else
{
echo "<EMBED src='$repertoire$fichmidi[$aleatoire]' AUTOSTART=true HIDDEN=true loop=true></EMBED>";}
}
?>
Cordialement
Ton code php est plutot pour faire une liste de lecture, non?
J'ai trouvé ça
http://www.journaldunet.com/...
et ça
4. Controlling an Embedded Sound using JavaScript (New)
A minor variation on 3. is to use the JavaScript getElementById() function in the EvalSound definition. This is actually the preferred method for recent browsers, but is not supported by older versions. The function and the sound object then becomes:
<script>
function EvalSound(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.Play();
}
</script>
<embed src="success.wav" autostart=false width=0 height=0 id="sound1"
enablejavascript="true">
Note that we specify name of the embedded sound using its ID attribute now. The function calls however are the same as above. For example:
<form>
<input type="button" value="Play Sound" onClick="EvalSound('sound1')">
</form>
extrait de http://www.phon.ucl.ac.uk/home/mark/audio/play.htm
J'ai trouvé ça
http://www.journaldunet.com/...
et ça
4. Controlling an Embedded Sound using JavaScript (New)
A minor variation on 3. is to use the JavaScript getElementById() function in the EvalSound definition. This is actually the preferred method for recent browsers, but is not supported by older versions. The function and the sound object then becomes:
<script>
function EvalSound(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.Play();
}
</script>
<embed src="success.wav" autostart=false width=0 height=0 id="sound1"
enablejavascript="true">
Note that we specify name of the embedded sound using its ID attribute now. The function calls however are the same as above. For example:
<form>
<input type="button" value="Play Sound" onClick="EvalSound('sound1')">
</form>
extrait de http://www.phon.ucl.ac.uk/home/mark/audio/play.htm