Solved

Play mouseover sound in this menu script

Posted on 2004-08-04
7
558 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Industry Leaders: 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!

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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

732 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