<html>
<head>
<title>Using an alphabetical sort() method on strings</title>
<script type="text/javascript" language="javascript">
<!-- //
function alphabetical(a, b)
{
var A = a.toLowerCase();
var B = b.toLowerCase();
if (A < B){
return -1;
}else if (A > B){
return 1;
}else{
return 0;
}
}
function SortElements() {
var colors = new Array("red","Red","blue","Blue","green","Green");
colors.sort(alphabetical);
var cj = colors.join(", ");
alert(cj);
}
// -->
</script>
</head>
<body onload="SortElements()">
</body>
</html>