Solved

Play mouseover sound in this menu script

Posted on 2004-08-04
7
559 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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

617 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