Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Play mouseover sound in this menu script

Posted on 2004-08-04
7
Medium Priority
?
562 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 200 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

972 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