gibster wrote:
Perfect!
thanks
Charlie.
PS. that closing ul tag was just a typo in the post, but well spotted.
You may want to also considert using textContent for DOM 3 compliant
browsers (Mozilla et al and maybe IE one day) and innerText for IE.
That way your li can contain other markup that will be automatically
removed.
<script type="text/javascript">
function showContent( id )
{
var el = document.getEle mentById(id);
if ( el.textContent ){
alert(el.textCo ntent);
} else if ( el.innerText ){
alert(el.innerT ext);
}
}
</script>
<ul id="theUL">
<li id="anLi1"><b>s ome</b> <i>text</i></li>
<li id="anLi2"><spa n style="color:re d;">some</span> other text</li>
</ul>
<button onclick="showCo ntent('anLi1')" >anLi1</button>
<br>
<button onclick="showCo ntent('anLi2')" >anLi2</button>
--
Rob