Solved

Play mouseover sound in this menu script

Posted on 2004-08-04
7
555 Views
Last Modified: 2010-05-18
Is there anyway to edit this script so it will play a simple beep like sound when a mouseover occurs over each of the menu items?

Script:
www{dot}accomplishhosting{dot}com/~klr/menu.txt
{dead link - ee_ai_construct, cs admin}
0
Comment
Question by:killer455
  • 4
  • 2
7 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 11714616
Like this:

lib_obj.prototype.ShowMenu = function(){this.css.visibility="visible";beep()}
function beep(){
  document.getElementById('mySound').src="click.wav";
};
document.write('<bgsound id="mySound" loop=1>');
// END MENU CODE -->

0
 

Author Comment

by:killer455
ID: 11716849
where should this be added?
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 50 total points
ID: 11716985
This line is in your upper page script, add the beep() call in that line:
lib_obj.prototype.ShowMenu = function(){this.css.visibility="visible";beep()}

And this lines can be at the end of that script section:
function beep(){
  document.getElementById('mySound').src="click.wav";
};
document.write('<bgsound id="mySound" loop=1>');


0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 63

Expert Comment

by:Zvonko
ID: 11717012
Of corse you have to change my wave file name to your wave file name. I used the click.wav
If your wave file is in another directory, then you have to change path accordingly.

0
 

Author Comment

by:killer455
ID: 11717035
Nevermind figured where to add it.  However I have one question.  What do you change if you only want it to play the sound on the main menu and not on the sub menu items?
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 11717329
Include your sound function (beep() or whatever) in this:

document.write("<div style='position:absolute;"+ALIGN+":"+ADJ[i]+";top:"+MFT+";width:"+Top_Width[i]+"' onmouseover='o["+i+"].ShowMenu();BEEP();' onmouseout='o["+i+"].HideMenu()'>")

I typed it in uppercase, but you should change that to your function name and make it the right case.

Regards,
${Zyloch}
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11717454
Or change the beep() function to this:

function beep(){
  if(event.srcElement.className=="menu_TOP")
    document.getElementById('mySound').src="click.wav";
};

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now