Fijate así:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
<script>
function addListener(Obj, event, eventHandler) {
//
if( Obj.addEventListener ) {
Obj.addEventListener(event, eventHandler, false);
} else if( Obj.attachEvent ) {
Obj.attachEvent("on"+event, eventHandler);
}
}
function switchDisplay(event){
if(window.event)
alert(window.event.srcElement.id)
else{
alert(event.target.id)
}
}
</script>
</head>
<body onload="addListener(document.getElementById('item_1'), 'click', switchDisplay);">
<ul>
<li id="item_1">Autos</li>
<li id="item_1_data">
Ford - Chevrolette - Ferrari
</li>
<li id="item_2">Verduras</li>
<li id="item_2_data">
Papa - Zanahoria - Tomate
</li>
</ul>
</body>
</html>