Skip to content

ASP.Net Web Form

GR Shekar

Asked Jan 28, 2015, 8:22 AM EST1 answer
Share
LinkedInX
how to add background music my web form when first time loaded???

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Pranay Rana
    0
    You can make use of HTML5 tag called Audio and put script like as below which allows you to play file you want


    HTML / XML
    <html><body onload="playSound();"> <audio id="noise"></audio> </body> <script> function playSound(){     var snd=document.getElementById('noise');     canPlayMP3 = (typeof snd.canPlayType === "function" && snd.canPlayType("audio/mpeg") !== "");     snd.src=canPlayMP3?'shorttones.mp3':'shorttones.ogg';     snd.load();     snd.play(); } </script></html>
    0