Click here to Skip to main content
12,504,462 members (54,023 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Javascript audio HTML5
Hi

I'm trying to access audio tag from iframe and my code doesn't work!!!


is it right or not???


h1.html
<audio id="player" src="" controls="controls"></audio>
<iframe src="" id="h2.html" width="700" height="800"></iframe>

h2.html
<script type="text/javascript">
function show(id) {
    var player=window.parent.document.getElementById('player');
    player.src=id;
    player.load();
    player.play();
}
</script>
<a href="java<!-- no -->script: show('1/Videon.mp3')">song1</a>
<a href="java<!-- no -->script: show('1/Somewhere.mp3')">song2</a>
Posted 3-Jan-13 18:01pm
davemas333
Updated 3-Jan-13 18:16pm
v3
Comments
Sandeep Mewara 4-Jan-13 0:17am
   
Audio tag from iframe or before iframe? Please clarify.
davemas 4-Jan-13 7:36am
   
audio tag in the top and then iframe
davemas 4-Jan-13 8:04am
   
this code only works online is there any code to make access parent window or to access element in another page offline????????

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 4 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100