Don't see what I missed to get this working. I've looked over it a couple times bumping it to my book and didn't notice any difference. Anybody see what I missed? Thanks.
Jake
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Personal Organizer</title>
</head>
<body>
<script type="text/javascript">
<! HIDE FROM INCOMPATIBLE BROWSERS
function addTask() {
if (document.forms[0].newtask.value == "")
window.alert("You must enter a value in the New Task field.");
else {
if (document.forms[0].tasks.options.value == "tasks")
document.forms[0].tasks.options[0] = null;
var newTask = new Option();
newTask.value = document.forms[0].newtask.value;
newTask.text = document.forms[0].newtask.value;
var numTasks = document.forms[0].tasks.options.length;
document.forms[0].tasks.options[numTasks] = newTask;
document.forms[0].newtask.value = "";
}
}
function deleteTask() {
var selectedTask = 0;
var taskSelected = false;
while (selectedTask < document.forms[0].tasks.length) {
if (document.forms[0].tasks.options[selectedTask].selected == true) {
taskSelected = true;
break;
}
++selectedTask;
}
if (taskSelected == true)
document.forms[0].tasks.options[selectedTasks] = null;
else
window.alert("You must select a task in the list.");
}
function ascendingSort() {
var newTasks = new Array();
for (var i =0; i < document.forms[0].tasks.length; ++i) {
newTasks[i] = document.forms[0].tasks.options[i].value;
}
newTasks.sort();
for (var j =0; j < document.forms[0].tasks.length; ++j) {
document.forms[0].tasks.options[j].value = newTasks[j];
document.forms[0].tasks.options[j].text = newTasks[j];
}
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
<h1>Personal Organizer</h1>
<h2>Task List</h2>
<form action="">
<p>New Task <input type="text" size="68" name=""newtask" /></p>
<p><input type="button" value="Add Task" onclick="addTask()"
style="width: 150px" />
<input type="button" value="Delete Selected Task"
onclick="deleteTask()" style="width: 150px" />
<input type="button" value="Delete All Tasks"
onclick="document.forms[0].task.options.length = 0;"
style="width: 150px" /><br />
<input type="button" value="Ascending Sort"
onclick="ascendingSort()" style="width: 150px" />
</p>
<p><select name="tasks" size="10" style="width: 500px">
<option value="tasks">Tasks</option></select></p>
</form>
</body>
</html>