Como lanzar una ventana pop-up de advertencia?

juan
10 de Agosto del 2005
Hola, tengo un login y password hecho en ASP y me gustaria que cuando el usuario introduciera un login o password incorrecto me salga una ventana de esas que dice " Nombre de usuari o password no valido" y hay un boton para aceptar (creo que son en Javascript).

Se puede meter javascript dentro de una web asp?

Gracias y salu2.

jaxolotl
10 de Agosto del 2005
######### INSERTAR DENTRO HEAD ##################
<script language="JavaScript" type="text/javascript">

//function to check empty fields

function isEmpty(strfield1, strfield2, strfield3) {


//change "field1, field2 and field3" to your field names
strfield1 = document.forms[0].uno.value
strfield2 = document.forms[0].dos.value
strfield3 = document.forms[0].tres.value

//name field
if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
{
alert(""Field1" is a mandatory field.nPlease amend and retry.")
return false;
}

//url field
if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
{
alert(""Field2" is a mandatory field.nPlease amend and retry.")
return false;
}

//title field
if (strfield3 == "" || strfield3 == null || strfield3.charAt(0) == ' ')
{
alert(""Field3" is a mandatory field.nPlease amend and retry.")
return false;
}
return true;
}


//function to check valid email address
function isValidEmail(strEmail){
validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
strEmail = document.forms[0].email.value;

// search email text for regular exp matches
if (strEmail.search(validRegExp) == -1)
{
alert('A valid e-mail address is required.nPlease amend and retry');
return false;
}
return true;
}


//function that performs all functions, defined in the onsubmit event handler

function check(form){
if (isEmpty(form.uno)){
if (isEmpty(form.dos)){
if (isEmpty(form.tres)){
if (isValidEmail(form.email)){
return true;
}
}
}
}
return false;
}

</script>

################# EJEMPLO DE FORM ###############

<form name="theform" method="post" action="#" onSubmit="return check(this);">
Field 1: (required!)<br />
<input name="uno" type="text" /><br />
Field 2: (required!)<br />
<input name="dos" type="text" />
<br>
Field 3 (required!)<br>
<input name="tres" type="text" id="field3" />
<br>
E-Mail Address (required!)<br>
<input name="email" type="text" id="email" />
<br />
<input name="submit" type="submit" />
</form>