Click to See Complete Forum and Search --> : Selected index not work on...


Zero-x252
08-02-2003, 02:46 PM
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?]


<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>

:confused:

Zero-x252
08-02-2003, 03:13 PM
HELLO I NEED SOME HELP AM I INVISIBLE (sorry for the snootiness of it but still maybe today i'd like some help) ??? HELLLLLLLLLLLOOOOOOOOO

Bootsman123
08-02-2003, 04:05 PM
About the cookies:
http://www.webreference.com/js/column8/property.html



<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>

Bootsman123
08-02-2003, 04:07 PM
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.

Zero-x252
08-02-2003, 06:34 PM
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

Zero-x252
08-02-2003, 06:56 PM
ok i just DONT UNDERSTAND COOKIES

Khalid Ali
08-02-2003, 10:29 PM
Originally posted by Zero-x252
ok i just DONT UNDERSTAND COOKIES


and ????

Zero-x252
08-02-2003, 11:03 PM
NOR DO I UNDERSTAND HOW TO WRITE THEM AND i fixed the pages minor errors but it still dont work?

Bootsman123
08-03-2003, 02:16 AM
Post your new code here then and what you have been trying to do with the cookies.

Zero-x252
08-03-2003, 02:53 AM
CODE:

<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="legofrk234@aol.com">
<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>

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...