justincredible
02-21-2007, 03:21 PM
function buildSelect(status){
var xmlhttp=false;
try{// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e){// Internet Explorer
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert('Your browser does not support AJAX!');
return false;
}
}
}
var file = 'chapterAjax.php?chapterStatus=';
xmlHttp.open('GET',file+status,true);
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
for (x = document.getElementById('selectedChapter').length; x >= 0; x--) {
document.getElementById('selectedChapter')[x] = null;
}
var content = xmlHttp.responseText.split(",");
document.getElementById('selectedChapter')[0] = content[377];
for(var i=0;i<content.length;i++){
document.getElementById('selectedChapter')[i] = content[i];
}
document.getElementById('activeChapterBox').disabled = false;
document.getElementById('workingChapterBox').disabled = false;
document.getElementById('nonactiveChapterBox').disabled = false;
document.getElementById('hiddenChapterBox').disabled = false;
document.getElementById('modifiedChapterBox').disabled = false;
}
else{
document.getElementById('activeChapterBox').disabled = true;
document.getElementById('workingChapterBox').disabled = true;
document.getElementById('nonactiveChapterBox').disabled = true;
document.getElementById('hiddenChapterBox').disabled = true;
document.getElementById('modifiedChapterBox').disabled = true;}
}
xmlHttp.send(null);
return;
}
I cannot seem to get the bolded part to do the correct thing.
The for-loop before that is used to completely wipe out my multiselect and I want the bolded code to re-populate that multiselect with the elements that are now in content.
Any ideas?
var xmlhttp=false;
try{// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e){// Internet Explorer
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert('Your browser does not support AJAX!');
return false;
}
}
}
var file = 'chapterAjax.php?chapterStatus=';
xmlHttp.open('GET',file+status,true);
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
for (x = document.getElementById('selectedChapter').length; x >= 0; x--) {
document.getElementById('selectedChapter')[x] = null;
}
var content = xmlHttp.responseText.split(",");
document.getElementById('selectedChapter')[0] = content[377];
for(var i=0;i<content.length;i++){
document.getElementById('selectedChapter')[i] = content[i];
}
document.getElementById('activeChapterBox').disabled = false;
document.getElementById('workingChapterBox').disabled = false;
document.getElementById('nonactiveChapterBox').disabled = false;
document.getElementById('hiddenChapterBox').disabled = false;
document.getElementById('modifiedChapterBox').disabled = false;
}
else{
document.getElementById('activeChapterBox').disabled = true;
document.getElementById('workingChapterBox').disabled = true;
document.getElementById('nonactiveChapterBox').disabled = true;
document.getElementById('hiddenChapterBox').disabled = true;
document.getElementById('modifiedChapterBox').disabled = true;}
}
xmlHttp.send(null);
return;
}
I cannot seem to get the bolded part to do the correct thing.
The for-loop before that is used to completely wipe out my multiselect and I want the bolded code to re-populate that multiselect with the elements that are now in content.
Any ideas?