Ver Mensaje Individual
  #3 (permalink)  
Antiguo 30/12/2008, 19:18
binagol
 
Fecha de Ingreso: agosto-2008
Ubicación: Buenos Aires
Mensajes: 247
Antigüedad: 15 años, 9 meses
Puntos: 6
Respuesta: onclick="check(1,10,'test.php')"

jeje... creia que era algo diferente... no me di cuenta de lo que era...

lo que hace la funcion es bastante... y en cuanto metio ajax.. me mato... me cuesta mucho seguirlo y entenderlo...

la funcion (junto con todas las que llama desde la misma funcion) es:

function Nuevo(){
var xmlhttp=false;
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}

function abrir(div) {
if (document.getElementById(div).style.display != 'none') { document.getElementById(div).style.display = 'none'; }
else { document.getElementById(div).style.display = ''; }


}
error = 'no';
function check (a,total,url) {
if (document.getElementById("errors").style.display != 'none') { document.getElementById("errors").style.display = 'none'; }
document.getElementById("oculta").style.display = '';
document.getElementById("muestro").style.display = 'none';
var value = document.getElementById('in'+a).value;
var name = document.getElementById('in'+a).name;

if (name == 'password') {
checkpassword(a);
a++;
setTimeout("check('"+a+"','"+total+"','"+url+"')", 500);
return true;

}






ajax=Nuevo();
ajax.open("POST", "/ajax/"+url,true);
ajax.onreadystatechange=function() {
if (( ajax.readyState==4) && ( ajax.status == 200 )) {
if (ajax.responseText == "si") { change(a,'green');
}
else { if (name != 'password2') { error = 'si'; change(a,'red'); } }
a++;
if (a <= total) { setTimeout("check('"+a+"','"+total+"','"+url+"')", 500); }
else { if (error != 'si') { document.registro.submit(); return true; }
document.getElementById("errors").style.display = '';
document.getElementById("errores").innerHTML = "<li>Ocurrieron errores durante el registro</li>";
document.getElementById("oculta").style.display = 'none';
document.getElementById("muestro").style.display = '';
error = 'no';
}
}

}



ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send(name+"="+value);



}

function checkpassword(a) {
var value = document.getElementById('in'+a).value;
var name = document.getElementById('in'+a).name;
a++;
var value1 = document.getElementById('in'+a).value;
var name1 = document.getElementById('in'+a).name;

if (value == value1 && value.length >= 6) {
change(a,"green");
a=a-1;
change(a,"green");
}
else {
change(a,"red");
error = 'si';
a=a-1;
change(a,"red");
}

}

function radiocheck (stat,id) {
if (stat == 'yes') {
change(id,"green");
}
else {
change(id,"red");
}

}


function change(id,color) {
if (color == 'red') { var colorsito = 'url(/images/arrow_lighred.gif) no-repeat right center'; }
if (color == 'green') { var colorsito = 'url(/images/arrow_lighgreen.gif) no-repeat right center'; }
document.getElementById(id).style.background = colorsito;

}


function cambiar (a) {
var valor = document.getElementById("in6").value;
if (a == 'cpanel') {
if (valor == 2082) { document.getElementById("registro").action = 'http://www.invisionarg.com:2082/login/'; }
if (valor == 2083) { document.getElementById("registro").action = 'https://www.invisionarg.com:2083/login/'; }
}
else {
if (valor == 2082) { document.getElementById("registro").action = 'http://www.invisionarg.com:2095/'; }
if (valor == 2083) { document.getElementById("registro").action = 'https://www.invisionarg.com:2096/'; }
}
}

gracias por la ayuda....
si alguien tiene ganas de darme una mano para entenderlo.. se lo voy a agradecer... jeje

feliz año nuevo para todos..:!!!

Última edición por binagol; 30/12/2008 a las 19:25 Razón: agregue todo elcodigo... hay funciones que llaman a otras... hacen falta para entender..