Hi,

I'm learning JavaScript ComboBoxes and have one below with icons, but I would like the first selection to display the country selected and the cookie to keep that selection. It's not working quite right for me.

Can someone assist?

Thanks in advance.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Menu</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/functions.js" type="text/javascript"></script>
<script language="javascript">
var oldLang, newLang;

function chLangList() {
oldLang = parseInt(readCookie('langID'));

$('#nav-flag-lists').children("li").each(function() {
$(this).css('visibility','visible');
$(this).css('height','20px');
});

var newLang = $('#nav-flag-lists').children("li").eq(oldLang).children("a").html();
$("#selCC").html(newLang);
$('#nav-flag-lists').children("li").eq(oldLang).css('visibility','hidden');
$('#nav-flag-lists').children("li").eq(oldLang).css('height','0');
}
function chLang(langID) {
eraseCookie('langID');
createCookie('langID', langID, 30);
chLangList();
}
</script>
</head>
<body onload="chLangList();">
<ul id="nav-flag" class="nav">
<li>
<a id="selCC">United States <img src="images/usa.gif" alt="United States" /></a>
<ul id="nav-flag-lists">
<li><a onclick="chLang(0);" href="test.html">United States <img src="images/usa.gif" alt="United States" /></a></li>
<li><a onclick="chLang(1);" href="test.html">Canada <img src="images/can.gif" alt="Canada" /></a></li>
<li><a onclick="chLang(2);" href="test.html">Mexico <img src="images/mex.gif" alt="Mexico" /></a></li>
<li><a onclick="chLang(3);" href="test.html">United Kingdom <img src="images/uk.gif" alt="United Kingdom" /></a></li>
<li><a onclick="chLang(4);" href="test.html">Nederlands <img src="images/ned.gif" alt="Nederlands" /></a></li>
<li><a onclick="chLang(5);" href="test.html">Brazil <img src="images/bra.gif" alt="Brazil" /></a></li>
<li><a onclick="chLang(6);" href="test.html">Colombia <img src="images/col.gif" alt="Colombia" /></a></li>
<li><a onclick="chLang(7);" href="test.html">Germany <img src="images/ger.gif" alt="Germany" /></a></li>
<li><a onclick="chLang(8);" href="test.html">Chile <img src="images/chi.gif" alt="Chile" /></a></li>
<li><a onclick="chLang(9);" href="test.html">Costa Rica <img src="images/cos.gif" alt="Costa Rica" /></a></li>
<li><a onclick="chLang(10);" href="test.html">Venezuela <img src="images/ven.gif" alt="Venezuela" /></a></li>
<li><a onclick="chLang(11);" href="test.html">Puerto Rico <img src="images/pur.gif" alt="Puerto Rico" /></a></li>
</ul>
</li>
</ul>
</body>
</html>