/    Sign up×
Community /Pin to ProfileBookmark

How do I pass an array value to a html or text file

Ok heres what I’m workin on… ( Please note I am a real Novice at this)

I’m trying to make a simple HTML JukeBox for my site. I have been able to use a double list box to list the bands in one box(doublecombo) and the associated Song titles(MP3’s) for the chosen band in the second Box(stage2) and with a Submit button I can Play the file. I guess that was the easy part of the project.

What I’m trying to add now is a playlist and the controls to Add, Remove, and Play a selection from array to a playlist file which will saved server side with an m3u extension.

The controls I like to add are “Add to PLay List” “Remove From Play List” and “Play Playlist”

The final piece I’d like to add is some type of User Name validation so the m3u files gets saved with their “Handle.m3u” so Server can stream to multiple users with different Play list…

Heres the current code I have. it’s not pretty but I’m only concerned with fuctionality now and will dress up the page later using tables…

<html>
<Font Face = “Comic SANS MS” font Size = 48>
<center>
<Head>Music Box</Head>

</font>
<body bgcolor = “#606096” Text = “#FFFF00”>

<form name=”doublecombo”>
<p><select name=”example” size=”1″ onChange=”redirect(this.options.selectedIndex)”>
<option>Humble Pie</option>
<option>Eric Clapton</option>
<option>Pink Floyd</option>
<option>Uriah Heep</option>
</select>
<select name=”stage2″ size=”1″>
<option value=”http://www.byte-psyche.com/ctctest/mp3s/Humble pie/Idontneednodoctor.m3u”>I Don’t Need No Doctor</option>
<option value=”http://www.byte-psyche.com/ctctest/mp3s/Humble pie/yoursogoodforme.m3u”>Your So Good For Me</option>
<option value=”http://www.byte-psyche.com/ctctest/mp3s/Humble pie/hallelujah.m3u”>Hallelujah</option>
<option value=”http://www.byte-psyche.com/ctctest/mp3s/Humble pie/imready.m3u”>I’m Ready</option>
<option value=”http://www.byte-psyche.com/ctctest/mp3s/Humble pie/30days.m3u”>30 Days in the Hole</option>
<option value=”http://www.byte-psyche.com/ctctest/mp3s/Humble pie/all.m3u”>Play Them All </option>
</select>

<form>
<input type=”button” value=” Add to Play List ” onclick=”displayHTML(this.form)”>
<br>
</form>
<input type=”button” name=”test” value=”Play Selected Title”
onClick=”go()”>

<script>

<!–

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(“I Don’t Need No Doctor”,”http://www.byte-psyche.com/ctctest/mp3s/Humble Pie/Idontneednodoctor.m3u”)
group[0][1]=new Option(“You’re So Good for Me”,”http://www.byte-psyche.com/ctctest/mp3s/Humble Pie/yoursogoodforme.m3u”)
group[0][2]=new Option(“Hallelujah”,”http://www.byte-psyche.com/ctctest/mp3s/Humble Pie/hallelujah.m3u”)
group[0][3]=new Option(“I’m Ready”,”http://www.byte-psyche.com/ctctest/mp3s/Humble Pie/imready.m3u”)
group[0][4]=new Option(“30 Days In The Hole”,”http://www.byte-psyche.com/ctctest/mp3s/Humble Pie/30days.m3u”)
group[0][5]=new Option(“Play Them All”,”http://www.byte-psyche.com/ctctest/mp3s/Humble Pie/all.m3u”)

group[1][0]=new Option(“How I Wish It Would Rain”,”http://www.byte-psyche.com/ctctest/mp3s/Eric Clapton/wi****wouldrain.m3u”)
group[1][1]=new Option(“Old Love”,”http://www.byte-psyche.com/ctctest/mp3s/Eric Clapton/oldlove.m3u”)
group[1][2]=new Option(“Riding With the King”,”http://www.byte-psyche.com/ctctest/mp3s/Eric Clapton/ridingwiththeking.m3u”)
group[1][3]=new Option(“While My Guitar Gently Weeps”,”http://www.byte-psyche.com/ctctest/mp3s/Eric Clapton/whilemyguitargentlyweeps.m3u”)

group[2][0]=new Option(“On The Turning Away”,”http://www.byte-psyche.com/ctctest/mp3s/Pink Floyd/ontheturningaway.m3u”)
group[2][1]=new Option(“Comfortably Numb”,”http://www.byte-psyche.com/ctctest/mp3s/Pink Floyd/comfortablynumb.m3u”)

group[3][0]=new Option(“Circle Of Hands”,”http://www.byte-psyche.com/ctctest/mp3s/Uriah Heep/circleofhands.m3u”)
group[3][1]=new Option(“July Morning”,”http://www.byte-psyche.com/ctctest/mp3s/Uriah Heep/julymorning.m3u”)
group[3][2]=new Option(“Stealing”,”http://www.byte-psyche.com/ctctest/mp3s/Uriah Heep/stealing.m3u”)
group[3][3]=new Option(“Look At Yourself”,”http://www.byte-psyche.com/ctctest/mp3s/Uriah Heep/lookatyourself.m3u”)
group[3][4]=new Option(“Sunrise”,”http://www.byte-psyche.com/ctctest/mp3s/Uriah heep/sunrise.m3u”)
group[3][5]=new Option(“Tears In My Eyes”,”http://www.byte-psyche.com/ctctest/mp3s/Uriah heep/tearsinmyeyes.m3u”)
group[3][6]=new Option(“Play All”,”http://www.byte-psyche.com/ctctest/mp3s/Uriah heep/all.m3u”)

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
}

function go(){
location=temp.options[temp.selectedIndex].value
}

function displayHTML(form) {
var inf = temp.options[temp.selectedIndex].value;
win = window.open(“, “, ‘popup’, ‘toolbar = no, status = no’);
win.document.write(“” + inf + “”);
}

//–>
</script>
</form>

</body>

</html>

Thanks for the takin the time to have a look at this for me…

Peace…

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @xTerMn8r spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...