Código HTML:
Ver original
function myf()
{
window.alert(document.getElementById("nombre").value);
// window.alert("Hola mundo");
}
<input type="text" name="nombre" id="nombre" maxlength="20" size="20" /> <input type="text" name="nombre2" maxlength="20" size="20" /> <input type="button" name="boton" value="Buscar" onclick="myf()" />
<?
?>
Te faltava asignarle el id en el input, pruebalo ahora.
Saludos.