/    Sign up×
Community /Pin to ProfileBookmark

Selected index not work on…

this is my entire PlayList/music player code but when i try to play the file it doesn’t work can somebody help
[and another thing how would you write a cookie to store the files in the users playlist?]

[COLOR=orangered]
<html>
<head>
<title>JavaScript test</title>
<script language=”javascript”><!–//BEGIN
function addmusfile()

{
var the_data = document.the_form.the_music.value
if (the_data != “”) {

var mus_file = the_data;

var the_list = window.document.the_form.playlist;

var num_options = the_list.options.length;

var new_option = new Option;

var name= prompt(‘What is the song/movie name?’,”)
new_option.text = name;

the_list.options[num_options]= new_option;

}
}
function open(){
if (the_form.playlist.options[form.liste1.selectedIndex].text != “” && the_form.playlist.options[form.liste1.selectedIndex].text != ‘PlayList:’){
window.confirm(‘Are you sure you want to open’ + the_form.playlist.options[form.liste1.selectedIndex].text +’?’)
var win=open(“about:blank”,”Music”,”toolbars=no,scrollbars=yes”); //no decorations but scrollbars
win.document.open();
win.document.writeln(‘<style type=”text/css”><!–body {background: #000000; margin: 0px 0px 0px 0px”}–></style><embed src=”‘ + the_form.playlist.options[form.liste1.selectedIndex].text + ‘”‘ +’ loop=”-1″></embed>’)
win.document.close();
}
else {
document.write(”)
}
}
//END–></script>
<style type=”text/css”>
<!–
option.2 {font-size: 20px; ruby-align: center; text-align: center}

body {font-family: stopD; font-size: 30px; background: #000000;color: #FFFFFF; margin: 0px 0px 0px 0px}

input {width: 100%;margin: 0px 0px 0px 0px; font-family: stopD; font-size: 16px; background: #000000; border: thick double #FFFFFF; color: #FFFFFF}

input.2 {width: 100%; font-family: stopD; font-size: 16px; height: 50px; background: #000000; border: thick double #FFFFFF; color: #FFFFFF}

select {width: 100%; margin: 0px 0px 0px 0px; font-family: stopD; font-size: 16px; background: #000000; border: thick double #FFFFFF; color: #FFFFFF}

/* End of style section. Generated by AceHTML at 8/2/03 1:26:33 PM */
–>
</style>
</head>
<body>
<center> MUSIC PLAYER</center>
<form name=”the_form”>
<input type=”file” name=”the_music” onChange=”addmusfile()”><br>
<select name=”playlist” size=”10″ width=”100%”>
<option class=”2″ width=”100%”>PlayList:
</select>

<input class=”2″ type=”button” value=”Play” onClick=”open()”>
</form>

</form>
</body>
</html>
[/COLOR]
?

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@Zero-x252authorAug 02.2003 — [b][u]HELLO I NEED SOME HELP AM I INVISIBLE (sorry for the snootiness of it but still maybe today i'd like some help) ??? HELLLLLLLLLLLOOOOOOOOO[/u][/b]
Copy linkTweet thisAlerts:
@Bootsman123Aug 02.2003 — About the cookies:

http://www.webreference.com/js/column8/property.html


[code=php]
<html>
<head>
<title>JavaScript test</title>
<script language="javascript"><!--//BEGIN
function addmusfile()

{
var the_data = document.the_form.the_music.value
if (the_data != "") {

var mus_file = the_data;

var the_list = window.document.the_form.playlist;

var num_options = the_list.options.length;

var new_option = new Option;

var name= prompt('What is the song/movie name?','')
new_option.text = name;

the_list.options[num_options]= new_option;

}
}
function open(){
if (the_form.playlist.options[form.liste1.selectedIndex].text != "" && the_form.playlist.options[form.liste1.selectedIndex].text != 'PlayList:'){
window.confirm('Are you sure you want to open' + the_form.playlist.options[form.liste1.selectedIndex].text +'?')
var win=open("about :blank","Music","toolbars=no,scrollbars=yes"); //no decorations but scrollbars
win.document.open();
win.document.writeln('<style type="text/css"><!--body {background: #000000; margin: 0px 0px 0px 0px"}--></style><embed src="' + the_form.playlist.options[form.liste1.selectedIndex].text + '"' +' loop="-1"></embed>')
win.document.close();
}
else {
document.write('')
}
}
//END--></script>
<style type="text/css">
<!--
option.2 {font-size: 20px; ruby-align: center; text-align: center}

body {font-family: stopD; font-size: 30px; background: #000000;color: #FFFFFF; margin: 0px 0px 0px 0px}

input {width: 100%;margin: 0px 0px 0px 0px; font-family: stopD; font-size: 16px; background: #000000; border: thick double #FFFFFF; color: #FFFFFF}

input.2 {width: 100%; font-family: stopD; font-size: 16px; height: 50px; background: #000000; border: thick double #FFFFFF; color: #FFFFFF}

select {width: 100%; margin: 0px 0px 0px 0px; font-family: stopD; font-size: 16px; background: #000000; border: thick double #FFFFFF; color: #FFFFFF}

/* End of style section. Generated by AceHTML at 8/2/03 1:26:33 PM */
-->
</style>
</head>
<body>
<center> MUSIC PLAYER</center>
<form name="the_form">
<input type="file" name="the_music" onChange="addmusfile()"><br>
<select name="playlist" size="10" width="100%">
<option class="2" width="100%">PlayList:
</select>

<input class="2" type="button" value="Play" onClick="open()">
</form>

</form>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@Bootsman123Aug 02.2003 — I don't see any input type named "liste1" or it can be my mistake that none has to be named like that, because I'm not that good at Javascript.
Copy linkTweet thisAlerts:
@Zero-x252authorAug 02.2003 — Yea i figured out that that was wrong but now I NEED TO figure out why the selected entire value isnt going on thru the popup piece
Copy linkTweet thisAlerts:
@Zero-x252authorAug 02.2003 — ok i just DONT UNDERSTAND COOKIES
Copy linkTweet thisAlerts:
@Khalid_AliAug 03.2003 — [i]Originally posted by Zero-x252 [/i]

[B]ok i just DONT UNDERSTAND COOKIES [/B][/QUOTE]



and ????
Copy linkTweet thisAlerts:
@Zero-x252authorAug 03.2003 — NOR DO I UNDERSTAND HOW TO WRITE THEM AND i fixed the pages minor errors but it still dont work?
Copy linkTweet thisAlerts:
@Bootsman123Aug 03.2003 — Post your new code here then and what you have been trying to do with the cookies.
Copy linkTweet thisAlerts:
@Zero-x252authorAug 03.2003 — CODE:
[code=php]
<html>
<!-- Generated by AceHTML Freeware http://freeware.acehtml.com -->
<!-- Creation date: 8/2/03 -->
<head>
<script language="javascript"><!--//BEGIN
var start = '<style type="text/css"><!--body{margin: 0px 0px 0px 0px; background: #000000} input {width: 100%; height: 5%; color: #FFFFFF; background: #000000; border: medium double #FFFFFF;} --></style><embed width="100%" height="95%" src="file:///'
var finish = '"></embed><br><input type="button" onClick="window.close();return false;" value="Done">'
function play(){
if(!win) { //open on if another window dosn't exist
var win= window.open("about:blank","Prewiev","toolbars=no,scrollbars=yes,alwaysRaised=yes"); //no decorations but scrollbars
}
win.document.open(); //open for writing
win.document.write(start + the_form.playlist.options[the_form.playlist.selectedIndex].value + finish); //write the contents of the textarea
win.document.close(); //close for writing
}
function add()
{
var the_data = document.the_form.music.value

var mus_file = the_data;

var the_list = window.document.the_form.playlist;

var num_options = the_list.options.length;

var new_option = new Option;

new_option.text= prompt('What do you wish to list this file as in the playlist?','')

new_option.value = mus_file;

the_list.options[num_options]= new_option;
}
//END--></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="[email protected]">
<meta name="generator" content="AceHTML 5 Freeware">
<style type="text/css">
<!--
option.2 {font-size: 20px; ruby-align: center; text-align: center}

body {font-family: stopD; font-size: 30px; background: #000000;color: #FFFFFF; margin: 0px 0px 0px 0px}

input {width: 100%;margin: 0px 0px 0px 0px; font-family: stopD; font-size: 16px; background: #000000; border: thick double #FFFFFF; color: #FFFFFF}

input.2 {width: 100%; font-family: stopD; font-size: 16px; height: 50px; background: #000000; border: thick double #FFFFFF; color: #FFFFFF}

select {width: 100%; margin: 0px 0px 0px 0px; font-family: stopD; font-size: 16px; background: #000000; border: thick double #FFFFFF; color: #FFFFFF}

/* End of style section. Generated by AceHTML at 8/2/03 1:26:33 PM */
-->
</style>
</head>
<body>

<form name="the_form" onSubmit="play()">
<center>Add To Playlist::</center>
<input type="file" name="music" onChange="add()">
<br>
<center>Playlist::</center>
<select name="playlist" size="8">
</select>
<input type="submit" value="Play!">
</form>
</body>
</html>
[/code]

Pupose of cookies::

to store the playlist and then when the page is loaded to check for the cookie and if its there to load the playlist that is stored back into play somehow...
×

Success!

Help @Zero-x252 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...