Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2

Thread: Playing sounds

  1. #1
    Junior Member
    Join Date
    May 2003
    Location
    Vienna, Austria
    Posts
    2
    Member #
    1399
    Is there an easy way to play a sound when scrolling over an image with the mouse, and when I click on an image? WITHOUT opening an additional window, opening the windows media player? If JavaScript is needed for this, that's fine too.

    Thanks, Jeremy

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    Welcome to the board, Jeremy?

    Try this code snippet. The onMouseOvers will trigger the events:
    Code:
    <html>
    <body>
    
    <script language="JavaScript"><!--
    function playSound() { document.firstSound.play(); }
    function pauseSound() { document.firstSound.pause(); }
    function stopSound() { document.firstSound.stop(); }
    //--></script>
    
    <a href="#" onMouseOver="playSound()"><img src="play.gif" width="100" height="100"></a><br>
    <a href="#" onMouseOver="pauseSound()"><img src="pause.gif" width="100" height="100"></a><br>
    <a href="#" onMouseOver="stopSound()"><img src="stop.gif" width="100" height="100"></a><br>
    
    <embed src="sound.wav" hidden=true autostart=false loop=false name="firstSound" mastersound>
    
    </body>
    </html>
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:40 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com