Does anyone know how to create audio buttons?

Discussion in 'HTML & Website Design' started by geester1, Jan 8, 2009.

  1. #1
    Im looking to insert an image into a webpage and when someone clicks on it it plays music, can anyone point me in the right direction....

    PLEASE>>...
     
    geester1, Jan 8, 2009 IP
  2. cupidsorchard

    cupidsorchard Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    don't know the exact code but best thing to try is to google your question verbatim
     
    cupidsorchard, Jan 8, 2009 IP
  3. myst729

    myst729 Peon

    Messages:
    289
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It's better to do it with flash, IMHO.
     
    myst729, Jan 8, 2009 IP
  4. Jaguarjace

    Jaguarjace Guest

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    
    <html>
    
    <head>
    <title>Welcome!</title>
    
    <bgsound id="soundfiles"> 
    </head>
    
    <body>
    
    <script language="JavaScript">
    <!--
    // Sounds for onclick
    
    var aySound = new Array();
    // put your sounds below this line
    aySound[0] = "http://www.wav-sounds.com/answering_machine/homersimpson.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>
    
    <img onclick="playSound(0);" src="http://voch.files.wordpress.com/2007/07/homer_simpson_2006.png" width="300" height="401">
    
    </body>
    
    </html>
    
    Code (markup):
    Click Homer Simpson XD
     
    Jaguarjace, Jan 8, 2009 IP
  5. Jaguarjace

    Jaguarjace Guest

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you can use
    style="cursor:pointer;"
    Code (markup):
    anywhere in the img area if you want to change the cursor when the cursor is on the image. ;)
     
    Jaguarjace, Jan 8, 2009 IP