Okay...I've been trying to debug the following javascript and I still can't get it to work in IE (works just fine in Netscape 4.73 and 7.0, that's the weird part)....
JAVASCRIPT CODES
function butAdd_onClick() {
var inSelect = document.formQuestionListing.selQuestionListing;
//Depends on a fram named 'survey'
var outSelect = parent.survey.document.formNewQuestions.selSurveyQuestions;
for(var i=0; i<inSelect.length; i++) {
if(inSelect.options.selected) {
newOpt = new Option(inSelect.options.text, inSelect.options.value, false, false);
var iIndex = outSelect.selectedIndex;
//Kinda ugly ... you have to manually move all of the options down for
//an insert
for(var k=outSelect.length; k>outSelect.selectedIndex; k--)
outSelect.options[k] = outSelect.options[k-1];
outSelect.options[iIndex]=newOpt;
outSelect.options[iIndex].selected = false;
outSelect.options[iIndex+1].selected = true;
outSelect.selectedIndex = iIndex + 1;
}
else {
alert("You did not select a question.");
return false;
}
}
//Refreshes the listbox in the survey frame
parent.survey.history.go(0);
}
</script>
Basically, this script is supposed to move selections from a drop-down (multiple select) from one window to another drop-down (multiple select) in another window.
HTML FORM CODES (WINDOW 1: Selector)
<SELECT NAME="selQuestionListing" SIZE="10" MULTIPLE
onChange="questionList_onChange()">
<OPTION Value="7409">Which of the following vehicles would you prefer to win in a contest? (AT&T proposal survey 1/16/01)
<OPTION Value="7410">If you chose other, please specify a vehicle that is approximately $25,000 or less. (AT&T proposal survey 1/16/01)
<SELECT>
<INPUT name="butAdd" type="button" value="<<Add" onClick="butAdd_onClick()">
</FORM>
HTML FORM CODES (WINDOW 2: Selected)
<SELECT id="selNewSurvey" name="selSurveyQuestions" size="15">
<OPTION value="0" selected>
</select>
The javascript I receive in IE is the following:
Line: 41
Char: 5
Error: Object doesn't support this property or method
Code: 0
URL: ****************************************
Line 41 is the following:
Any suggestions and/or corrections are welcome and greatly appreciated.
Thanks.
========================================
Buh Bye!
Cheers,
Me
JAVASCRIPT CODES
Code:
<SCRIPT language="JavaScript"> function butAdd_onClick() {
var inSelect = document.formQuestionListing.selQuestionListing;
//Depends on a fram named 'survey'
var outSelect = parent.survey.document.formNewQuestions.selSurveyQuestions;
for(var i=0; i<inSelect.length; i++) {
if(inSelect.options.selected) {
newOpt = new Option(inSelect.options.text, inSelect.options.value, false, false);
var iIndex = outSelect.selectedIndex;
//Kinda ugly ... you have to manually move all of the options down for
//an insert
for(var k=outSelect.length; k>outSelect.selectedIndex; k--)
outSelect.options[k] = outSelect.options[k-1];
outSelect.options[iIndex]=newOpt;
outSelect.options[iIndex].selected = false;
outSelect.options[iIndex+1].selected = true;
outSelect.selectedIndex = iIndex + 1;
}
else {
alert("You did not select a question.");
return false;
}
}
//Refreshes the listbox in the survey frame
parent.survey.history.go(0);
}
</script>
Basically, this script is supposed to move selections from a drop-down (multiple select) from one window to another drop-down (multiple select) in another window.
HTML FORM CODES (WINDOW 1: Selector)
Code:
<FORM NAME="formQuestionListing" ACTION="/admin/questionlisting.cfm" METHOD="POST"> <SELECT NAME="selQuestionListing" SIZE="10" MULTIPLE
onChange="questionList_onChange()">
<OPTION Value="7409">Which of the following vehicles would you prefer to win in a contest? (AT&T proposal survey 1/16/01)
<OPTION Value="7410">If you chose other, please specify a vehicle that is approximately $25,000 or less. (AT&T proposal survey 1/16/01)
<SELECT>
<INPUT name="butAdd" type="button" value="<<Add" onClick="butAdd_onClick()">
</FORM>
HTML FORM CODES (WINDOW 2: Selected)
Code:
<FORM action="#AdminScriptDir#/submitnewsurvey.cfm" method="POST" name="formNewQuestions" target="_parent"> <SELECT id="selNewSurvey" name="selSurveyQuestions" size="15">
<OPTION value="0" selected>
</select>
The javascript I receive in IE is the following:
Quote:
Line: 41
Char: 5
Error: Object doesn't support this property or method
Code: 0
URL: ****************************************
Line 41 is the following:
Code:
outSelect.selectedIndex = iIndex + 1;Any suggestions and/or corrections are welcome and greatly appreciated.
Thanks.
========================================
Buh Bye!
Cheers,
Me