Pero el problema cual es
Código HTML:
Ver original<script type="text/javascript"> //<![CDATA[
function valida(){
var f = document.getElementById('xa');
alert(f.nombre.value);
return false;
}
function valida2(frm){
alert(frm.nombre.value);
return false;
}
//]]>
<input type="text" name="nombre"> <input type="button" onclick="return valida()" value="val" />
<form onsubmit ="return valida2(this)";> <input type="text" name="nombre"> <input type="submit" onclick=" value="val" />
incluso podrías poner simplemente un id al campo de texto y validar contra ese elemento
Saludos