Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:27
sound on a mouseover
Poster: wpatters1229
Dated: Saturday October 29 2005 - 2:30:46 BST
I know Ruth talked about this about a year ago but I was wondering if with the new menu files there might be an example of using a sound file on a mouseover. I just want to be sure of the script etc..
Thanks
Poster: Ruth
Dated: Tuesday November 1 2005 - 0:01:46 GMT
Hi,
Yes you can use a script. I've actually found a function that will work to activate sound on mouseover in Netscape7.1, Opera 7.1, 7.54, Firebird .07, Firefox 1.0.2, IE 5.5. I can't get it to work in Netscape6, 4.79. That may be because of whatever audio is used with them. I think 6 wants me to get quicktime, even though I have it set to use windows media player, and 4.79 uses some kind of sound class and beatnik. Anyway, I tried the function with the downloaded menu sample and it worked fine.
In the menu data file add this to the top of the file
Code:
function DHTMLSound(surl) {
document.getElementById("dummyspan").innerHTML=
"<embed src='"+surl+"' hidden=true autostart=true loop=false>";
}
document.getElementById("dummyspan").innerHTML=
"<embed src='"+surl+"' hidden=true autostart=true loop=false>";
}
I used the Home item to test it
Code:
aI("status=Back To Home Page;text=Home;url=http://www.milonic.com/;onfunction=DHTMLSound('success.wav');");
Substitute your own sound file.
Finally, on the pages you have to have a dummy span, so you need to add this to all pages someplace where you want it to work.
Code:
<span id=dummyspan></span>
This is the only one I found that works in multiple browsers, even though there were others that said they worked in Netscape and Mozilla, they didn't for me. Hope this helps. You'll have to test in Macs and on other browsers, those are the only ones I have for testing.
Ruth
Sound with menu
Poster: wpatters1229
Dated: Tuesday November 1 2005 - 21:35:36 GMT
I appreciate your testing this. The only thing that scares me away from this method is the fact that I have to place some code on each page. I have a site that has over 3000 pages and I just don't want to update all those pages.
Thanks
Poster: Ruth
Dated: Tuesday November 1 2005 - 22:51:25 GMT
Perhaps someone else would know how to do it by putting it in the menu, but I don't know. What happens if the span isn't on the page is just no sound plays. So maybe you could use it and just put the span on new pages as you do them? But, at least there is a method that seems to be cross browser, well somewhat.
Ruth