mouse over sounds

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Posts: 3
Joined: Mon Jun 11, 2007 2:52 pm

mouse over sounds

Postby ccater » Mon Apr 21, 2008 7:58 pm

hi all,

I was wondering if it is possible to have a sound happen when you rollover a menu item, and if so, what would the code be?

Thanks :)

User avatar
Posts: 8760
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA

Re: mouse over sounds

Postby Ruth » Tue Apr 22, 2008 8:13 pm

Yes, it is.

There are a lot of mouseover codes out there for sound. Most are browser specific. I found one that is cross browser, at least it works in Netscape7.1, 9, Opera 7.1, 7.54, Firebird .07, Firefox 1.0.2, 1.5,, IE 5.5, 6. I can't get it to work in Netscape6 or 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. I do not have mac so am unable to test for that OS.

So, to set up sound on mouseover you'd put this at the top of the menu data file

Code: Select all

function DHTMLSound(surl) {
    "<embed src='"+surl+"' hidden=true autostart=true loop=false>";

Then in the aI string where you want the sound on mouseover you'd call it like this

Code: Select all


Finally, you need to place a 'dummy' span on every page where you want it to work.

Code: Select all

<span id=dummyspan></span>

If no span is posted, the sound won't play and an error message will be given that document.getElement is null or not an object.

I do not know js functions but it would seem that for someone who does it would be possible to edit the sound function to add an if/else statement so no error message is generated if no span is on the page. Something where you tell it if the dummy span is there then play the sound, else no sound.


Return to “Help & Support for DHTML Menu Version 5+”

Who is online

Users browsing this forum: No registered users and 1 guest