------------------------------------ Posterior ------------------------------------
Prueba asi:
Código PHP:
<SCRIPT LANGUAGE="javascript">
<!--
function CheckField(frm)
{
var retour = 1;
//******* Initialisation
frm.Nom.style.backgroundColor="#FFFFFF";
frm.Cognom.style.backgroundColor="#FFFFFF";
frm.Email.style.backgroundColor="#FFFFFF";
frm.Tel.style.backgroundColor="#FFFFFF";
frm.Pregunta.style.backgroundColor="#FFFFFF";
//********* Test
if ( frm.Nom.value == "")
{
frm.Nom.style.backgroundColor="#FFB6C1";
retour=0;
}
if ( frm.Cognom.value == "")
{
frm.Cognom.style.backgroundColor="#FFB6C1";
retour=0;
}
if ( frm.Email.value == "")
{
frm.Email.style.backgroundColor="#FFB6C1";
retour=0;
}
if ( frm.Tel.value == "")
{
frm.Tel.style.backgroundColor="#FFB6C1";
retour=0;
}
if ( frm.Pregunta.value == "")
{
frm.Pregunta.style.backgroundColor="#FFB6C1";
retour=0;
}
if (frm.Email.value.indexOf('@', 0) == -1 ||
frm.Email.value.indexOf('.', 0) == -1) {
alert("Dirección de e-mail inválida");
frm.Email.focus();
return false;
}
return retour;
}
function NextPage()
{
document.form.submit();
}
function Check(frm)
{
if ( CheckField(frm)=='0')
{
window.alert("Ha d’omplir els camps, si us plau !");
}
else
{
NextPage();
}
}
-->
</script>
Y deja la llamada a la función como te dije en un principio:
Check(document.pro)
Dime si funciona.
Saludos.
------------------------------------ Posterior ------------------------------------
Olvida mis pruebas, haz lo que te dice tunait.
Saludos.