Más completito:
Código PHP:
<html>
<head>
<script>
function calcular(nacio){
fecha=new Date();
nacimiento=new Date(nacio);
edad=(fecha-nacimiento);
edad=Math.floor(edad/(1000*60*60*24*365));
alert("Tienes "+edad+" años");
}
</script>
</head>
<body
onload="pepe=prompt('Fecha de nacimiento\nformato (aaaa/mm/dd)','','');if(pepe){calcular(pepe)}"></body>
</html>