Solved

Play mouseover sound in this menu script

Posted on 2004-08-04
7
554 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

708 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

12 Experts available now in Live!

Get 1:1 Help Now