I have been working on a double combo box that will allow you to select media to play. You can select video, midi, or wav files from one box, and, depending on your selection, you can pick from a list of specific songs. They will be played in an <EMBED> in an <iframe> via codes from Javascriptkit , myself, and Liorean. The code goes as follows:
Code:
<html><head><title>Playroom!!</title> <script type="text/javascript"> <!--hide function dip() { var it=document.doublecombo.stage2.options[document.doublecombo.stage2.selectedIndex].value; alert('You chose '+it+' .'); var oIFrame = document.getElementById('i'), oFramedDoc = typeof oIFrame.contentDocument != 'undefined'? oIFrame.contentDocument: // W3C way typeof oIFrame.contentWindow != 'undefined'? oIFrame.contentWindow.document: // Microsoft way typeof oIFrame.document != 'undefined'? oIFrame.document: // Traditional way null; // And no way. if(oFramedDoc != null){ oFramedDoc.open(); oFramedDoc.write('o <embed src="'+it+'" autostart="false" loop="false" volume="50%" height="245" width="185" align=CENTER> i'); } } //--> </script> </head><body bgcolor=royalblue> <iframe id="i"></iframe> <input type="button" value="DooIt" onClick="dip()"> <form name="doublecombo"> <p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)"> <option>WAVs</option> <option>Video</option> <option>MIDI</option> </select> <select name="stage2" size="1"> <option value="songURL">SONG</option> <option value="songURL">SONG</option> <option value="songURL">SONG</option> </select> <script> <!-- /* Double Combo Script Credit By JavaScript Kit ([url]www.javascriptkit.com[/url]) Over 200+ free JavaScripts here! */ var groups=document.doublecombo.example.options.length var group=new Array(groups) for (i=0; i<groups; i++) group[i]=new Array() group[0][0]=new Option("JavaScript Kit","http://javascriptkit.com") group[0][1]=new Option("SONG","songURL") group[0][2]=new Option("SONG","songURL") group[1][0]=new Option("SONG","songURL") group[1][1]=new Option("SONG","songURL") group[2][0]=new Option("SONG","songURL") group[2][1]=new Option("SONG","songURL") group[2][2]=new Option("SONG","songURL") group[2][3]=new Option("SONG","songURL") var temp=document.doublecombo.stage2 function redirect(x){ for (m=temp.options.length-1;m>0;m--) temp.options[m]=null for (i=0;i<group[x].length;i++){ temp.options[i]=new Option(group[x][i].text,group[x][i].value) } temp.options[0].selected=true } //--> </script> </form> <a href="links1.html">Backc</a> any ideas? </body></html>
Comment