Click here to Skip to main content
15,887,355 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I'm trying to access audio tag from iframe and my code doesn't work!!!


is it right or not???


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


h2.html
JavaScript
<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
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900