title: How can I apply a JavaScript function on embedded audio?
body: <p>On my website I have an embedded audio that automatically starts and runs in the background (I have the audio embedded, because a normal  can't be autoplayed in chrome). Now I am trying to find a way to make that audio start at a random point in the clip.</p>
  
  <pre><code>&lt;body onload="audiofunction()"&gt;
          &lt;embed id="audio" src="berlin.mp3" type="audio/mpeg" autostart="true" loop="true"&gt;
  
          &lt;script&gt;
              function audiofunction(){
                  var audio = document.getElementById("audio");
                  alert(audio);
                  var max = audio.duration + 1;
                  audio.currentTime = Math.floor(Math.random() * max);
              }
          &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>That is how my Code looks like. I know that it works on normal audio, but with the embedded audio nothing happens.</p>
  
  <p>Maybe you could help me.</p>