Results 1 to 5 of 5

Play Sound on Mouseover or MouseClick

This is a discussion on Play Sound on Mouseover or MouseClick within the Programming forums, part of the Web Designing & Development category; [FONT=Arial, Helvetica, sans-serif][SIZE=2]There are 2 ways to play sound on mouseover. This first way seems to be more reliable than ...

  1. #1
    Senior Member Array akash's Avatar
    Join Date
    Oct 2008
    Location
    Heaven (Earth)
    Posts
    500

    Default Play Sound on Mouseover or MouseClick

    [FONT=Arial, Helvetica, sans-serif][SIZE=2]There are 2 ways to play sound on mouseover. This first way seems to be more reliable than the javascript version

    This is a great javascript which allows you to play different sounds as your visitors runs their mouse over each link or music on mouseover of an image.
    [/SIZE][/FONT][FONT=Arial, Helvetica, sans-serif][SIZE=2]STEP 1[/SIZE][/FONT]
    please post that code into body part of the web page...
    Code:
    <!-- --><bgsound id="soundfiles"> 
    <script language="JavaScript"><!-- // Sound on Mouseover javascript 
    supplied by http://www.hypergurl.com var aySound = new Array(); // PLACE YOUR 
    SOUND FILES BELOW aySound[0] = "CHORD.wav"; aySound[1] = "DING.wav"; 
    aySound[2] = "CHORD.wav"; // Don't alter anything below this line IE 
    = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 
    1:0; NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 
    1:0; ver4 = IE||NS? 1:0; onload=auPreload; function auPreload() { if (!ver4) return; 
    if (NS) auEmb = new Layer(0,window); else { Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>"; 
    document.body.insertAdjacentHTML("BeforeEnd",Str); } var Str = ''; for 
    (i=0;i<aySound.length;i++) Str += "<EMBED SRC='"+aySound[i]+"' 
    AUTOSTART='FALSE' HIDDEN='TRUE'>" if (IE) auEmb.innerHTML = Str; else 
    { auEmb.document.open(); auEmb.document.write(Str); auEmb.document.close(); } 
    auCon = IE? document.all.soundfiles:auEmb; auCon.control = auCtrl; } function 
    auCtrl(whSound,play) { if (IE) this.src = play? aySound[whSound]:''; else eval("this.document.embeds[whSound]." 
    + (play? "play()":"stop()")) } function playSound(whSound) 
    { if (window.auCon) auCon.control(whSound,true); } function stopSound(whSound) 
    { if (window.auCon) auCon.control(whSound,false); } //--></script> <!-- 
    -->
    [FONT=Arial, Helvetica, sans-serif][SIZE=2]STEP 2[/SIZE][/FONT]

    [FONT=Arial, Helvetica, sans-serif][SIZE=2]Simply add this code into each link, changing the number of the mouseover event to correspond to your sound file.[/SIZE][/FONT]
    [FONT=Arial, Helvetica, sans-serif][SIZE=2]onMouseOver="playSound(0)" onMouseOut="stopSound(0)"[/SIZE][/FONT]
    [FONT=Arial, Helvetica, sans-serif][SIZE=2]Your link code should look like this;

    <a href="http://www.yourlink.com" onMouseOver="playSound(0)" onMouseOut="stopSound(0)">YOUR LINK</a>[/SIZE][/FONT]

  2. #2
    Junior Member Array
    Join Date
    Jul 2009
    Posts
    1

    Post Re: Play Sound on Mouseover or MouseClick

    I have javascript code is entered to the blog, but not the RUN. why?

  3. #3
    Junior Member Array
    Join Date
    Sep 2009
    Posts
    3

    Default Re: Play Sound on Mouseover or MouseClick

    Hey Thanks for sharing such a useful post and you know i am just searching for this comment because i have to use it in my project.... all the information you share just so helpful to me... all that javascript coding i need it...

  4. #4
    Junior Member Array
    Join Date
    Oct 2009
    Posts
    6

    Default Re: Play Sound on Mouseover or MouseClick

    Thank you for sharing sound javascript on mouseover. It's worked for me....

  5. #5
    Senior Member Array
    Join Date
    Mar 2011
    Posts
    110

    Default Re: Play Sound on Mouseover or MouseClick

    Thank you very for sharing your knowledge,it is a very useful tool,I definitely use this concept.



Similar Threads

  1. Ready To Play Nice With 802.1X?
    By mayo in forum Member Discussion
    Replies: 2
    Last Post: 04-07-2010, 09:15 AM
  2. Script for changing text color on mouseover
    By akash in forum Web Design
    Replies: 4
    Last Post: 05-11-2009, 07:04 AM
  3. Play sound when mouse over
    By akash in forum Web Design
    Replies: 0
    Last Post: 02-27-2009, 06:20 AM
  4. My PC have a sound but not from PC speaker?
    By mss s in forum Tech Support
    Replies: 1
    Last Post: 04-11-2008, 07:08 PM

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
  •  
SEO Forum | Web Hosting Forum | Websites For Sale |