I've got it working with just two select list in Firefox but not in IE. IE is still throwing an error.
HTML Code:
<head>
<script language="JavaScript" type="text/javascript">
var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);
/*function getElementsByClass(node,searchClass,tag) {
var classElements = new Array();
var els = node.getElementsByTagName(tag); // use "*" for all elements
var pattern = new RegExp('\\b'+searchClass+'\\b');
for (var i = 0; i < els.length; i++)
if ( pattern.test(els[i].className) )
classElements[classElements.length] = els[i];
return classElements;
}
*/
var s1 = document.getElementById("selM");
var s2 = document.getElementById("sel2");
function deleteOption(s1)
{
var theIndex = s1.options.selectedIndex;
if (theIndex != -1){
s1.options[theIndex] = null;
}
}
function moveOptions(s1, s2)
{
var selMLength = s1.options.length;
for(var i=0; i<selMLength; i++)
{
if(s1.options[i].selected)
{
if (!addOption(s2, s1.options[i].text, s1.options[i].value)){
s1.options[i].selected = false; //remove selection if not duplicate and added
}
}
}
if(NS4) history.go(0);
}
function addOption(s2, txt, val){
//check if the option already exists
var dupe=false;
for (var i=0; i<s2.options.length; i++){
if (s2.options[i].value==val && s2.options[i].text==txt){
dupe=true;
break;
}
}
if (!dupe){ //add the option at the end
s2.options[s2.options.length] = new Option(txt, val);
setTimeout(function(){s2.options[s2.options.length-1].selected=true;},10); //delay selection in order for the combobox to scroll (if any) to the bottom.
}
return dupe;
}
var ctr=0;
function playSongs(){
var arr, len;
var sel = document.forms[0].sel2;
var defaultLen = 310; //6 mins
if (ctr<sel.options.length){
arr = sel.options[ctr].value.split("|");
if (arr.length>0 && arr[0]){
len = (Number(arr[1]))? Number(arr[1])*1000:defaultLen*1000; //in milliseconds
document.getElementById('music1').innerHTML='<object width="500" height="450" id="Player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject"><param name="URL" value="'+arr[0]+'"><param name="autoStart" VALUE="true"><param name="uiMode" value="full"><param name="currentPosition" vaule="1" ><param name="ShowStatusBar" value="true" ><embed type="application/x-mplayer2" src="'+arr[0]+'" ShowControls="0" width="300" height="300"></embed></object>';
}
ctr++;
setTimeout("playSongs()", len);
}
}
</script> </head.
HTML Code:
<body>
<div id="ChooseSeason" > <form id="misteriof" action="yourpage.asp" method="post">
<div id="slider">
<select name="sel1" size="13" multiple="multiple" onchange="this.form.sel2.selectedIndex=-1;" id="selM" class="channels" >
<option value="|" title="JAC" class="ice">JAC</option>
<option class="dark" value="http://www.fileden.com/files/2006/11/20/398972/HIM%20-%20Dark%20Light%20-%2004%20-%20Killing%20Loneliness.mp3|">H.I.M-Wings of a butterfly</option>
<option class="light" value="C:/Users/Talibah/TV on the PC/Jackie Chan Adventures/Season 3/S3E53 Jackie Chan Adventures - Re-Enter the J Team.avi|436">avi</option>
<option value="http://www.fileden.com/files/2006/11/20/398972/Seal%20-%20Kiss%20From%20A%20Rose.mp3|" class="dark">Seal-Kiss from a Rose</option>
<option value="http://www.fileden.com/files/2006/11/20/398972/The%20Alliance%20ft.%20Fabo%20-%20Tattoo%20(Dirty).mp3|" class="light">Alliance-Tattoo </option>
<option value="http://www.fileden.com/files/2006/11/20/398972/Cradle%20Of%20Filth%20-Nymphetamine.mp3|436" class="dark">Cradle of Filth-Nymphetamine</option>
<option value="http://www.fileden.com/files/2006/11/20/398972/Black%20Light%20Burns%20-%20Lie(1).mp3|" class="light">Black Light Burns-Lie</option>
<option value="http://www.fileden.com/files/2006/11/20/398972/Nelly%20Furtado%20-%20Maneater.mp3|" class="dark">Nelly Furtado-Maneater</option>
<option value="|">Em</option>
<option value="|">Em</option>
<option value="|">Em</option>
<option value="|">Em</option>
<option value="|">Em</option>
</select>
<div id="ubuttons">
<select name="sel2" size="4" multiple="multiple" onchange="this.form.sel1.selectedIndex=-1;" id="userChoose">
<option value="">Em</option>
</select>
<input type="button" value="add"
onclick="moveOptions(this.form.sel1, this.form.sel2);" />
<input type="button" value="Del"
onclick="deleteOption(this.form.sel2);" />
<input type="button" value="Play" onclick="playSongs()" />
</div>
</form> <!--blue trans background--> </div>
</body>
Bookmarks