Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IFrame difficulties media player

    Ok so im making a media player but i am having difficulties.


    Code:
    var albums=
    [
    	{	"title":"Birdsong Small Birds",
    		"artist":"BBC",
    			"artwork":"Wren",
    		"tracks":[
    			{"title":"Dunnock","mp3":"Birdsong-Dunnock.mp3",
    			"lyrics":"The Dunnock or hedge sparrow has a fast warbling song often delivered from the top of a hedge or bush"},
    			{"title":"Robin","mp3":"Birdsong-Robin.mp3",
    			"lyrics":"Unusually among British birds, both the male and the femaale robins sing"},
    			{"title":"Siskin","mp3":"Birdsong-Siskin.mp3",
    			"lyrics":"For many of us, lime green siskins are now regular garden visitors but usually in winter"},
    			{"title":"Wren","mp3":"Birdsong-Wren.mp3",
    			"lyrics":"For its size, just under 4 inches long, the wren must have the loudest song of any British bird"}
    		]
    	},
    	{	"title":"Birdsong Large Birds",
    		"artist":"BBC",
    		"artwork":"Wood Pigeon",
    		"tracks":[
    			{"title":"Collared Dove","mp3":"Birdsong-Collared_Dove.mp3",
    			"lyrics":"The monotonous triple coo of the collared dove is notorious for annoying makers of period drama by appearing on their location soundtracks"},
    			{"title":"Greater spotted woodpecker","mp3":"Birdsong-Greater_spotted_woodpecker.mp3",
    			"lyrics":"A loud 'chick' call tells you straight away that a great spotted woodpecker is about"},
    			{"title":"Lesser spotted woodpecker","mp3":"Birdsong-Lesser_spotted_woodpecker.mp3",
    			"lyrics":"Much rarer than its relative greater spotted woodpecker, the lesser spotted is only the size of a sparrow"},
    			{"title":"Swallow","mp3":"Birdsong-Swallow.mp3",
    			"lyrics":"For me the most welcome sight of spring is a swallow hawking flies around a barn or stable and using its forking tail to twist and turn with astonishing speed"},
    			{"title":"Swift","mp3":"Birdsong-Swift.mp3",
    			"lyrics":"Screaming parties of swifts dashing through the skies - when they return in early May some birds will have been on the wing for 18 months"},
    			{"title":"Wood pigeon","mp3":"Birdsong-Wood_pigeon.mp3",
    			"lyrics":"When Alfred Lord Tenyson wrote about the moan of doves in immemorial elm, he must have meant the wood pigeon"}
    		]
    	},
    	{	"title":"Birdsong Medium Birds",
    		"artist":"BBC",
    		"artwork":"Blackbird",
    		"tracks":[
    			{"title":"Blackbird","mp3":"Birdsong-Blackbird.mp3",
    			"lyrics":"Blackbirds are at their best on mild spring evenings when their leisurely contralto song is often heard just after rain"},
    			{"title":"Fieldfare","mp3":"Birdsong-Fieldfare.mp3",
    			"lyrics":"On a bleak winter day the sight and sound of a flock of fieldfares is always welcome"},
    			{"title":"Mistle Thrush","mp3":"Birdsong-Mistle_Thrush.mp3",
    			"lyrics":"Mistle thrushes often sing in mid-winter and spring from the tops of tall trees and their habit of singing in gusty weather has given them the country name of storm ****"},
    			{"title":"Redwing","mp3":"Birdsong-Redwing.mp3",
    			"lyrics":"The piercing sigh of redwings as they flood into Britain each autumn from Iceland and Scandinavia is often the only sign that flocks are passing overhead"},
    			{"title":"Song Thrush","mp3":"Birdsong-Song_Thrush.mp3",
    			"lyrics":"Song thrushes often repeat individual sections of their varied repertoire which can include up to a 100 different phrases"}
    		]
    	},
    	{	"title":"Birdsong Finches",
    		"artist":"BBC",
    		"artwork":"Greenfinch",
    		"tracks":[
    			{"title":"Bullfinch","mp3":"Birdsong-Bullfinch.mp3",
    			"lyrics":"Unlike its relatives the bullfinch sings rarely and very softly so if you do hear the mixture of flat whistles and strange creaking sounds, consider yourself to be very lucky"},
    			{"title":"Chaffinch","mp3":"Birdsong-Chaffinch.mp3",
    			"lyrics":"The loud, cheerful song of the chaffinch is one of the first real signs that Spring is on the way and can be heard from trees and tall shrubs in town and country"},
    			{"title":"Goldfinch","mp3":"Birdsong-Goldfinch.mp3",
    			"lyrics":"Goldfinches are heard in late spring and early summer more often than they are seen when leaves mask their delightful tinkling song"},
    			{"title":"Greenfinch","mp3":"Birdsong-Greenfinch.mp3",
    			"lyrics":"Greenfinches have two common songs: a rapid twitter rather like a canary and a lazy wheezing sound which conjours up warm summer days in the garden"}
    		]
    	},
    	{	"title":"Birdsong Tits",
    		"artist":"BBC",
    		"artwork":"BlueTit",
    		"tracks":[
    			{"title":"Blue Tit","mp3":"Birdsong-Blue_Tit.mp3",
    			"lyrics":"There aren't many gardens that don't have visiting blue tits and in Spring their lively, ringing trills form a constant backdrop"},
    			{"title":"Coal Tit","mp3":"Birdsong-Coal_Tit.mp3",
    			"lyrics":"If you have conifers in or near your garden you'll probably hear coal tits too"},
    			{"title":"Great Tit","mp3":"Birdsong-Great_Tit.mp3",
    			"lyrics":"If you hear a birdsong that you can't identify the chances are it's a great tit. The males have an astonishing variety of calls and songs"},
    			{"title":"Long tailed tit","mp3":"Birdsong-Long_tailed_tit.mp3",
    			"lyrics":"These wonderful birds often announce themselves before you see them with a series of soft spluttering calls rather like sneezing"}
    		]
    	}
    Ok that is my js file
    Code:
    <html>
    	<head>
    		<title>friday afternoon demo</title>
    		<script type="text/javascript" src='test.js'>
    		</script>
    		<script type="text/javascript">
    		var rec;
    		
    			function report(index){
    				rec = index;
    				 var html = '';
    				 html += '<select onchange="parent.write03(this.selectedIndex);">';
    				 for(var i=0; i<music_demo[index].content.length; i++){
    					 html += '<option>';
    					 html += music_demo[index].content[i];
    					 html += '</option>';
    				 }
    				 html += '</select>';
    				
    				 with(document.getElementById('iframe02').contentDocument){
    					 open();
    					 write(html);
    					 close();
    				 }
    			}
    			
    			function write03(index){
    				 with(document.getElementById('iframe03').contentDocument){
    					 open();
    					 write('<h1>User has selected '+ music_demo[rec].content[index] +'</h1>');
    					 close();
    				 }
    			}
    		</script>
    		
    	</head>
    	<body>
    	<h1>Example of dealing with data in external js file and multiple iframes</h1>
    	<hr><br>
    	<iframe id='iframe01'>
    	</iframe>
    	
    	<iframe id='iframe02'>
    	</iframe>
    	
    	<iframe id='iframe03'>
    	</iframe>
    	
    	<script type="text/javascript">
    	 var html = '';
    	 html += '<select onchange="parent.report(this.selectedIndex);">';
    	 for(var i=0; i<music_demo.length; i++){
    		 html += '<option>';
    		 html += music_demo[i].type;
    		 html += '</option>';
    	 }
    	 html += '</select>';
    	 
    	 with(document.getElementById('iframe01').contentDocument){
    		 open();
    		 write(html);
    		 close();
    	 }
    	</script>
    	
    	
    	</body>
    
    </html>
    i am trying to make it so when i select a album the tracks of that album are shown in the second iframe but i am having difficulties
    Last edited by Spookster; 11-25-2012 at 01:33 AM.

  • #2
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    really struggling just want a tip? or an idea on how to tackle the problem


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •