<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset:utf-8">
<title>Test</title>
<script type="text/javascript">
function listText()
{
// Get the UL
var ul = document.getElementById("yourUL");
// Get the LI in the UL
var liNodes = ul.getElementsByTagName("li");
// Iterate through the LI's
for( var i = 0; i < liNodes.length; i++ )
{
// Get the child nodes of the LI
var liChildren = liNodes.item(i).childNodes;
// Iterate through the child nodes of the LI
for( var j = 0; j < liChildren.length; j++ )
{
// Look for text nodes
if( liChildren.item(j).nodeType == liChildren.item(j).TEXT_NODE )
{
// Get the text node value
alert( liChildren.item(j).nodeValue );
}
}
}
}
</script>
</head>
<body onload="listText();">
<ul id="yourUL">
<li>Foo</li>
<li>Bar</li>
</ul>
</body>
</html>