How do you play sound on mouse over? I don't want to take the user to a different page which shows the embedded player. I guess it is possible by using java script.
Playing audio on mouse over.
Try this code dude:
Put onMouseOver="jsPlay('rollimg1sound')" for the link!
And for rollimg1sound specify one source!
And put one javascript for jsPlay() Function!
Im pasting one sample code here!
Try It!
Put onMouseOver="jsPlay('rollimg1sound')" for the link!
And for rollimg1sound specify one source!
And put one javascript for jsPlay() Function!
Im pasting one sample code here!
Try It!
| Code: |
| <html>
<head> </head> <bod> <script language="JavaScript1.4" type="text/javascript"> <!-- function jsPlay(soundobj) { var thissound= eval("document."+soundobj); try { thissound.Play(); } catch (e) { thissound.DoPlay(); } } //--> </script> <body> <a onMouseOver="jsPlay('rollimg1sound')" href="index.html">Play Sound</a> <embed name="rollimg1sound" src="mySoundFile.wav" autostart="false" mastersound hidden="true" volume=100 width=0 height=0></embed> </body> </html> |
This is a neat little script. Could be used if you put a button that says 'Play Music' or something, so the user doesn't have to here it if they don't want to.
yes you could use a button but would require a bit more code
[url]<html>
<head>
</head>
<bod>
<script language="JavaScript1.4" type="text/javascript">
<!--
function jsPlay(soundobj) {
var thissound= eval("document."+soundobj);
try {
thissound.Play();
}
catch (e) {
thissound.DoPlay();
}
}
//-->
</script>
<body>
<a onClick="jsPlay('rollimg1sound')" href="index.html">Play Sound</a>
<embed name="rollimg1sound" src="mySoundFile.wav" autostart="false" mastersound hidden="true" volume=100 width=0 height=0></embed>
</body>
</html>[/url]
[url]<html>
<head>
</head>
<bod>
<script language="JavaScript1.4" type="text/javascript">
<!--
function jsPlay(soundobj) {
var thissound= eval("document."+soundobj);
try {
thissound.Play();
}
catch (e) {
thissound.DoPlay();
}
}
//-->
</script>
<body>
<a onClick="jsPlay('rollimg1sound')" href="index.html">Play Sound</a>
<embed name="rollimg1sound" src="mySoundFile.wav" autostart="false" mastersound hidden="true" volume=100 width=0 height=0></embed>
</body>
</html>[/url]
| htmlrules wrote: |
| yes you could use a button but would require a bit more code
[url]<html> <head> </head> <bod> <script language="JavaScript1.4" type="text/javascript"> <!-- function jsPlay(soundobj) { var thissound= eval("document."+soundobj); try { thissound.Play(); } catch (e) { thissound.DoPlay(); } } //--> </script> <body> <a onClick="jsPlay('rollimg1sound')" href="index.html">Play Sound</a> <embed name="rollimg1sound" src="mySoundFile.wav" autostart="false" mastersound hidden="true" volume=100 width=0 height=0></embed> </body> </html>[/url] |
Please quote the things you are copying!
the [ url ] is not for mentioning html tags!
Its for specifying website addresses!
and while quoting codes, you can use [ code ] !!
