SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Not Bad, eh? Justin Sampson's Avatar
    Join Date
    Aug 2000
    Location
    N.S., Canada
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Does anyone now where I can find a javascript that plays a .wav file when someone moves there mouse over an image? I was looking around for a while and the closest one I could find didn't work in Internet Explorer.

    Thanks,
    Justin Sampson

  2. #2
    SitePoint Addict
    Join Date
    Aug 2000
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Place the following in between the <head></head> tags:

    <script language="JavaScript">
    <!--
    function MM_controlSound(x, _sndObj, sndFile) { //v3.0
    var i, method = "", sndObj = eval(_sndObj);
    if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = "play";
    else {
    if (window.MM_WMP == null) {
    window.MM_WMP = false;
    for(i in sndObj) if (i == "ActiveMovie") {
    window.MM_WMP = true; break;
    } }
    if (window.MM_WMP) method = "play";
    else if (sndObj.FileName) method = "run";
    } }
    if (method) eval(_sndObj+"."+method+"()");
    else window.location = sndFile;
    }
    //-->
    </script>


    Place the following where you want the image to appear (between the <body> Tags:

    <a href="#" onMouseOver="MM_controlSound('play','document.CS972759327450','NAME_OF-FILE.wav')"><img src="location_of_your_Image.gif" width="219" height="121" border="0"></a>
    <EMBED NAME='CS972759327450' SRC='NAME_OF_FILE.wav' LOOP=false
    AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0>
    </EMBED>


    GOOD LUCK

  3. #3
    SitePoint Member abitanga's Avatar
    Join Date
    Nov 2000
    Location
    Dystopia
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried getting this to work in combination with a image flip mouseover effect but the 'File Download' message box kept appearing when I moused over.

    However, it DID work when I took out the image flip effect.

    Does anyone know a way to combine the two effects (image flip and soundover) properly?


  4. #4
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For sound mouseovers, you might like to use the SuperScripter tool available at Builder.com - check out the article at http://www.builder.com/Programming/S...r.txt.ss061900 then use the tool to generate the sound mouseover.

    As for combining image flipping and the sound and the downloading, do you want to post the code here? I'll have a look at it and see what I can come up with. As far as I am aware it can be done but it can be a bit tricky..
    My 2 Cents (or is that 2.2 Cents including GST?)

  5. #5
    SitePoint Addict
    Join Date
    Oct 2000
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If the moderators will permit, we do offer a *free* download kit with sample code that shows how to do this.

    It's available here...

    http://codebrain.com/javascript/kits/index.html

    See the JavaScript sound kit.


Bookmarks

Posting Permissions

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