I am designing a HTML web page which allows the user to query an xml file. Basically, they choose the column they would like to query, the search type and then type in their value. However, if they choose between in the combo box, then after the first text input box, I would like an & label, and another input box to appear.
The current code is below:
Author
Title
Pages
Year
function configureDropDownLists(ddl1,ddl2) {
var string = new Array('Contains', 'Equals');
var number = new Array('=', '', 'Between', '!=' );
switch (ddl1.value) {
case 'author':
document.getElementById(ddl2).options.length = 0;
for (i = 0; i < string.length; i++) {
createOption(document.getElementById(ddl2), string[i], string[i]);
}
break;
case 'title':
document.getElementById(ddl2).options.length = 0;
for (i = 0; i < string.length; i++) {
createOption(document.getElementById(ddl2), string[i], string[i]);
}
break;
case 'pages':
document.getElementById(ddl2).options.length = 0;
for (i = 0; i < number.length; i++) {
createOption(document.getElementById(ddl2), number[i], number[i]);
}
break;
case 'year':
document.getElementById(ddl2).options.length = 0;
for (i = 0; i < number.length; i++) {
createOption(document.getElementById(ddl2), number[i], number[i]);
}
break;
default:
document.getElementById(ddl2).options.length = 0;
break;
}
}
function createOption(ddl, text, value) {
var opt = document.createElement('option');
opt.value = value;
opt.text = text;
ddl.options.add(opt);
}
function configureTextFields(ddl2) {
switch (ddl2.value) {
case 'Between':
// Need code here?