Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Button Sounds

  1. #1
    Regular Coder
    Join Date
    Oct 2006
    Posts
    181
    Thanks
    1
    Thanked 6 Times in 6 Posts

    Question Button Sounds

    OK, i am a total n00b when it comes to JavaScript, however, i think this is what i need...

    i have fairly good knowledge with HTML, CSS, and PHP, but JS is my downfall..

    i have a web-site and when the user hovers the mouse over a button, i want it to make a sound, and also, i want it to make a different sound when it is clicked..

    the sound will be a split second, like a beep, and will not be repeated...

    i would greatly appreciate if someone could help me with this...

    ---also, the buttons are actually images/links...

    thank you in advance,
    Quote Originally Posted by Excavator
    write it for firefox then hack it for IE

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,081
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    You need something like:-

    <embed src="firstSound.wav" hidden="true" autostart="false" name="soundfile1">
    <embed src="secondSound.wav" hidden="true" autostart="false" name="soundfile2">

    <p>="center"><a href="linkToAFile.html" ONMOUSEOVER="document.soundfile1.play(); ONCLICK="document.soundfile2.play();</a>

    And please do not thank people in advance - it is rude and announces that you simply take offered help for granted.

  • #3
    Regular Coder
    Join Date
    Oct 2006
    Posts
    181
    Thanks
    1
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by Philip M View Post
    You need something like:-

    <embed src="firstSound.wav" hidden="true" autostart="false" name="soundfile1">
    <embed src="secondSound.wav" hidden="true" autostart="false" name="soundfile2">

    <p>="center"><a href="linkToAFile.html" ONMOUSEOVER="document.soundfile1.play(); ONCLICK="document.soundfile2.play();</a>

    And please do not thank people in advance - it is rude and announces that you simply take offered help for granted.
    ok, sorry for thanking you lol...

    ohh, and do they have to be .wav will mp3 work, or any other formats..?

    hmm, like i say, i n00b when it comes to JS... is this JS (do i need open and close JS tags) or is it all HTML..??? sorry if this sounds like a pathetic question...
    Quote Originally Posted by Excavator
    write it for firefox then hack it for IE

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,081
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Yes, other formats (MIDI, MP3 etc.) will work.

    This is just HTML, there is actually no JavaScript involved.

    Have a look at http://www.catb.org/~esr/faqs/smart-questions.html,
    and you will see why it is better not to thank people in advance, and to avoid grovelling. To increase your chances of a helpful response just ask your question in an adult and straightforward manner.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •