below is a code im working on I want the drop downs to change as one is selected and also update the text area
also how would I add more drop downs to the string? thank you
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - NOTE GENERATOR 2.2</title>
<script type="text/javascript">
function configureDropDownLists(ddl1,ddl2) {
var colours = new Array('Black', 'White', 'Blue');
var shapes = new Array('Square', 'Circle', 'Triangle');
var names = new Array('John', 'David', 'Sarah');
switch (ddl1.value) {
case 'Colours':
document.getElementById(ddl2).options.length = 0;
for (i = 0; i < colours.length; i++) {
createOption(document.getElementById(ddl2), colours[i], colours[i]);
}
break;
case 'Shapes':
document.getElementById(ddl2).options.length = 0;
for (i = 0; i < colours.length; i++) {
createOption(document.getElementById(ddl2), shapes[i], shapes[i]);
}
break;
case 'Names':
document.getElementById(ddl2).options.length = 0;
for (i = 0; i < colours.length; i++) {
createOption(document.getElementById(ddl2), names[i], names[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 updateTextArea() {
var text = "";
$('input[type=DropDown]:selected').each( function() {
text += $(this).val() + " ";
});
$('input[type=DropDown]:selected').each( function() {
text += $(this).val() + " ";
});
$('#update').val( text );
}
Bookmarks