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 10 of 10
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Help with adding sound on mouse-click

    I am trying to add sound to my website, on mouse-click.
    I am using Dreamweaver. I went to Behaviors, and clicked "play sound", and chose a sound to play. I have this sound in my local folder, and Dreamweaver inserted it into my code, right after a link.
    But the sound does not play when I test it!
    Please help asap....
    Thanks.
    (the link to my site is www.trecall.com.)
    here is the html code:
    <li><a href="smart_pay.html" onClick="MM_controlSound('play','document.CS1305532951843','Swoosh 3-SoundBible.com-1573211927.wav')">Smart Pay</a></li>- this is the code for the mouse-click.
    And this is the code that dreamweaver inserted into the <head>:
    <script type="text/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>
    Last edited by suave design; 05-16-2011 at 10:26 AM.

  • #2
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    626
    Thanks
    51
    Thanked 67 Times in 67 Posts
    http://webdesign.about.com/od/sound/...sound_oncl.htm

    The first page in my Google search.
    "Yeah science!"

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I tried that, too. It did not work- there is no sound when I test it in the browser.
    CAn anyone help please?

  • #4
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    This is an incorrect definition for a function:
    Code:
    function playSound('Swoosh 3-SoundBible.com-1573211927.wav') {
    I presume it should be
    Code:
    function playSound(soundfile) {
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #5
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    626
    Thanks
    51
    Thanked 67 Times in 67 Posts
    Yeah, your URL is invalid.
    "Yeah science!"

  • #6
    New to the CF scene
    Join Date
    May 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I changed it to
    Code:
    function playSound(soundfile) {
    as you instructed, and I still don't hear any sounds on mouse-click!
    What can be causing this problem?
    Here is the link to my site:www.trecall.com
    Please help! Thank you!!

  • #7
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Your page still shows
    Code:
    function playSound('Swoosh 3-SoundBible.com-1573211927.wav') {
    which causes an error.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • Users who have thanked AndrewGSW for this post:

    suave design (05-17-2011)

  • #8
    New to the CF scene
    Join Date
    May 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you Andrew, it now works, and I hear the sound!
    One more thing. I have an animated menu in my site that I would also like to add sound to. (on mouseover) But this menu does not have links. Where would I add the code then? To see what I mean, please go to www.trecall.com
    This is a sample of one of the tabs on the animated menu:
    Code:
    div class="cc_item" style="z-index:5;">
                  <div class="cc_content_6"> <img src="images/img2.jpg" alt="" /> <span class="cc_title">Grow <br />
                    Your Practice</span> <span class="cc_submenu"> <span>Grow Your Practice</span> </span> </div>
                </div>
    Thank you very much!!

  • #9
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Depending which element you want to mouseover it might be
    Code:
    div class="cc_item" style="z-index:5;">
                  <div class="cc_content_6" onmouseover="playSound('Swoosh 3-SoundBible.com-1573211927.wav');"> <img src="images/img2.jpg" alt="" /> <span class="cc_title">Grow <br />
                    Your Practice</span> <span class="cc_submenu"> <span>Grow Your Practice</span> </span> </div>
                </div>
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #10
    New to the CF scene
    Join Date
    May 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    okay, I actually added it to
    Code:
    <div class="cc_item" style="z-index:6;margin-right:14px;"onmouseover="playSound('Whish-Sith_Mas-494.wav');">
    But it does not play right. It's choppy. (Instead of being one steady sound, it's broken up.) Do you know why this could be?
    Also, sometimes when I open up the site, the sounds (on both menus) are not heard at all, and sometimes they are. What can be causing this??
    Thanks for your help!


  •  

    Posting Permissions

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