JavaScript:
Calculate age from date:
Copy/Delete items between dropdowns:
function addPlan(q) { selected = new Array(); for (var i = 0; i < list1.options.length; i++) { if (list1.options[i].selected) { selected.push(list1.options[i].value); var newOpt = new Option(list1.options[i].text, list1.options[i].value); var selLength = q.length; q.options[selLength] = newOpt; } } } function removeOldSchool(theSel) { var selIndex = theSel.selectedIndex; if (selIndex != -1) { for (i = theSel.length - 1; i >= 0; i--) { if (theSel.options[i].selected) { theSel.options[i] = null; } } if (theSel.length > 0) { theSel.selectedIndex = selIndex == 0 ? 0 : selIndex - 1; } } }
and the HTML:
Choice 1
Choice 2
Choice 3
Choice 4
Choice 5
Sample:
Choice 1
Choice 2
Choice 3
Choice 4
Choice 5