Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Problemas Login

Estas en el tema de Problemas Login en el foro de Frameworks JS en Foros del Web. Hola necesito ayuda para que estos dos scritp funcionen como uno ya que al ponerlos juntos tengo problemas no puedo cargar una pag para login ...
  #1 (permalink)  
Antiguo 09/07/2008, 07:23
 
Fecha de Ingreso: julio-2008
Mensajes: 2
Antigüedad: 15 años, 9 meses
Puntos: 0
Problemas Login

Hola necesito ayuda para que estos dos scritp funcionen como uno ya que al ponerlos juntos tengo problemas no puedo cargar una pag para login ojala alguien pudiese ayudarme graacias de antemano no entiendo mucho de ajax la idea creo k el problema es que ambas crean los mismos objetos

/**** Script para Login****/
function DoCallback(data)
{
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open('POST', url, true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
req.send(data);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject('Microsoft.XMLHTTP')
if (req) {
req.onreadystatechange = processReqChange;
req.open('POST', url, true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
req.send(data);
}
}
}

function processReqChange() {
// only if req shows 'loaded'
if (req.readyState == 4) {
// only if 'OK'
if (req.status == 200) {
eval(what);
} else {
alert('There was a problem retrieving the XML data: ' +
req.responseText);
}
}
}


/*****script para cargar pag y llenar BD ****//


function loadurl(url, id){
var pagecnx = createXMLHttpRequest();
pagecnx.onreadystatechange=function()
{
setpage(pagecnx, id)
}
pagecnx.open('GET', url, true)
pagecnx.send(null)
}

function loadurlkey(e,url,id){
tecla = (document.all) ? e.keyCode : e.which;
if (tecla==13)
loadurl(url,id);
}

function setpage(pagecnx, id){
if (pagecnx.readyState == 4 && (pagecnx.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(id).innerHTML=pagecnx.resp onseText;
}

function createXMLHttpRequest() {
var xmlHttp=null;
if (window.ActiveXObject)
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
else
if (window.XMLHttpRequest)
xmlHttp = new XMLHttpRequest();
return xmlHttp;


}
function objetoAjax(){
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 enviar(){
//donde se mostrará lo resultados
divResultado = document.getElementById('resultado');
//valores de los inputs
nom=document.productos.nombre.value;
des=document.productos.descrip.value;
stk=document.productos.stock.value;
val=document.productos.valor.value;
cat=document.productos.categ.value;
ajax=objetoAjax();

ajax.open("POST", "Insertar/registro.php",true);
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
divResultado.innerHTML = ajax.responseText
LimpiarCampos();
}
}
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
//enviando los valores
ajax.send("nombre="+nom+"&descrip="+des+"&stock="+ stk+"&valor="+val+"&categ="+cat)
}

function LimpiarCampos(){
document.productos.nombre.value="";
document.productos.descrip.value="";
document.productos.stock.value="";
document.productos.valor.value="";
document.productos.categ.value="";
document.productos.nombre.focus();
}
function eliminarDato(id){
divResultado = document.getElementById('resultado');
var eliminar = confirm("De verdad desea eliminar este dato?")
if ( eliminar ) {
ajax=objetoAjax();
ajax.open("GET", "eliminar/eliminacion.php?id="+id);
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
divResultado.innerHTML = ajax.responseText
}
}
ajax.send(null)
}
}
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:13.