Foros del Web » Programando para Internet » Javascript »

Mensaje de de espera...

Estas en el tema de Mensaje de de espera... en el foro de Javascript en Foros del Web. Estimados estoy utilizando DOM para cargar un archivo xml y mostrarlo con xls de la siguiente forma: source= new ActiveXObject("Microsoft.XMLDOM"); source.async= false; source.load(archivoxml); var xsl ...
  #1 (permalink)  
Antiguo 09/01/2008, 06:25
 
Fecha de Ingreso: abril-2001
Mensajes: 293
Antigüedad: 23 años, 9 meses
Puntos: 0
Mensaje de de espera...

Estimados estoy utilizando DOM para cargar un archivo xml y mostrarlo con xls de la siguiente forma:

source= new ActiveXObject("Microsoft.XMLDOM");
source.async= false;
source.load(archivoxml);

var xsl = new ActiveXObject("Microsoft.XMLDOM");
xsl.async=false;
xsl.load("..ruta/archivo.xsl");
tabla.innerHTML=source.transformNode(xsl);

mi problema esque no puedo agregarle un mensaje de espera y hay casos que demora bastante y pareciera que queda pegado el equipo

hay alguna forma de ponerle un mensaje de espera algo asi como "espere cargando info...", he probado camiandole xsl.async= true, pero se cae ya que no alzanza a cargarse el archivo y el objeto aun no existe.


si alguien ha realizado esto podria indicarme como hacerlo mediante este procedimiento.


saludos y muchas gracias
  #2 (permalink)  
Antiguo 10/01/2008, 09:52
 
Fecha de Ingreso: enero-2008
Mensajes: 8
Antigüedad: 17 años, 1 mes
Puntos: 0
Re: Mensaje de de espera...

Yo te ayudo cmunozp :)

una forma de agregar un mensaje de espera sería la siguiente.

En tu librería más primita de javascript agrega el siguiente código:

var StatusMsg =
{
CreateStatusMsg : function (msg, btnAbort)
{

var div = document.createElement("DIV");

div.id = "statusMsg";
div.style.display = "none";
div.style.zIndex = 20;

var tbl = div.appendChild(document.createElement("TABLE"));

tbl.style.width = "100%";
tbl.style.height = "100%";
tbl.border = "0";

var trow = tbl.insertRow();
var tdata = trow.insertCell();

tdata.style.width = "100%";
tdata.style.height = "100%";
tdata.style.verticalAlign = "middle";
tdata.align = "center";

var div2 = document.createElement("DIV");
tdata.appendChild(div2);

var img = document.createElement("IMG");
div2.appendChild(img);
img.src = "/Images/loading.gif";
img.align = "absmiddle";
img.id = "loadingGif";

var theMsg = document.createElement("DIV");
tdata.appendChild(theMsg);
theMsg.id = "theMsg";
theMsg.innerText = msg;
theMsg.style.fontWeight = "bold";
if(msg > "")
{
statusMessageString = msg;
}

if (btnAbort)
{
div.style.height = "90px";
var trow2 = tbl.insertRow();
var tdata2 = trow2.insertCell();
tdata2.style.width = "100%";
tdata2.style.height = "100%";
tdata2.style.verticalAlign = "middle";
tdata2.align = "center";
var btn = document.createElement("BUTTON");
tdata2.appendChild(btn);
btn.id = "Abort";
btn.innerText = "Cancel";
statusMessageButton=true;
}
else
{
statusMessageButton=false;
}
document.body.appendChild(div);
StatusMsg.divObj = div;
},
ShowStatusMsg : function(cTop, cLeft)
{
if (StatusMsg.divObj)
{
if (typeof cTop == "undefined")
{
cTop = document.body.clientHeight / 2 - 35;
}

if (typeof cLeft == "undefined")
{
cLeft = document.body.clientWidth / 2 - 75;
}

StatusMsg.CreateIframeStatusMsg(cTop, cLeft, StatusMsg.divObj.clientHeight+5, StatusMsg.divObj.clientWidth+5)
StatusMsg.CreateStatusMsg(statusMessageString, statusMessageButton);
StatusMsg.divObj.style.top = cTop;
StatusMsg.divObj.style.left = cLeft;

StatusMsg.iframeObj.style.display = "block";
StatusMsg.iframeObj.style.visibility = "visible";
StatusMsg.iframeObj.style.zIndex = 19;

StatusMsg.divObj.style.display = "block";
StatusMsg.divObj.style.visibility = "visible";
StatusMsg.iframeObj.style.zIndex = 20;
}
},
HideStatusMsg : function()
{
if (StatusMsg.iframeObj)
{
StatusMsg.iframeObj.style.display = "none";
StatusMsg.iframeObj.style.visibility = "hidden";
}
if (StatusMsg.divObj)
{
StatusMsg.divObj.style.display = "none";
StatusMsg.divObj.style.visibility = "hidden";
}
}
}

luego.. puedes hacer lo siguiente

en el onLoad de tu formulario ejecutar esto:

StatusMsg.CreateStatusMsg("HOLA ESTE ES UN MENSAJE", false);

cuando se vaya a cargar tu XML usa este:

StatusMsg.ShowStatusMsg();

y cuando quieras que desaparezca una vez cargado:

StatusMsg.HideStatusMsg();
  #3 (permalink)  
Antiguo 10/01/2008, 12:39
 
Fecha de Ingreso: abril-2001
Mensajes: 293
Antigüedad: 23 años, 9 meses
Puntos: 0
Re: Mensaje de de espera...

Hola gracias por contestar, he agregado la informacion, pero se cae en esta linea

StatusMsg.CreateIframeStatusMsg(cTop, cLeft, StatusMsg.divObj.clientHeight+5, StatusMsg.divObj.clientWidth+5)

dice que el objeto no acepta esta propiedad

podrias ayudarme..

saludos
  #4 (permalink)  
Antiguo 10/01/2008, 12:53
 
Fecha de Ingreso: enero-2008
Mensajes: 8
Antigüedad: 17 años, 1 mes
Puntos: 0
Re: Mensaje de de espera...

Por supuesto que te ayudaré :)

recuerda por favor reemplazar el loading.gif por la imagen que tu desees mostrar en el cuadro de diálogo de espera (usualmente un reloj de arena)

va el nuevo código:

var StatusMsg =
{
CreateIframeStatusMsg : function (myTop, myLeft, myHeight, myWidth)
{
var iframeStatusMask = document.createElement("IFRAME");

iframeStatusMask.id = "iframestatusmask";
iframeStatusMask.style.display = "none";
iframeStatusMask.style.position = "absolute";
iframeStatusMask.style.zIndex = 19;
iframeStatusMask.style.top = myTop;
iframeStatusMask.style.left = myLeft;
iframeStatusMask.style.height = myHeight;
iframeStatusMask.style.width = myWidth;
iframeStatusMask.style.backgroundColor = "#FFFFFF";
iframeStatusMask.scrolling = "no";
iframeStatusMask.frameBorder = 0;
iframeStatusMask.allowTransparency = false;
document.body.appendChild(iframeStatusMask);
StatusMsg.iframeObj = iframeStatusMask;
},
CreateStatusMsg : function (msg, btnAbort)
{

var div = document.createElement("DIV");

div.id = "statusMsg";
div.style.display = "none";
div.style.zIndex = 20;

var tbl = div.appendChild(document.createElement("TABLE"));

tbl.style.width = "100%";
tbl.style.height = "100%";
tbl.border = "0";

var trow = tbl.insertRow();
var tdata = trow.insertCell();

tdata.style.width = "100%";
tdata.style.height = "100%";
tdata.style.verticalAlign = "middle";
tdata.align = "center";

var div2 = document.createElement("DIV");
tdata.appendChild(div2);

var img = document.createElement("IMG");
div2.appendChild(img);
img.src = "/Images/loading.gif";
img.align = "absmiddle";
img.id = "loadingGif";

var theMsg = document.createElement("DIV");
tdata.appendChild(theMsg);
theMsg.id = "theMsg";
theMsg.innerText = msg;
theMsg.style.fontWeight = "bold";
if(msg > "")
{
statusMessageString = msg;
}

if (btnAbort)
{
div.style.height = "90px";
var trow2 = tbl.insertRow();
var tdata2 = trow2.insertCell();
tdata2.style.width = "100%";
tdata2.style.height = "100%";
tdata2.style.verticalAlign = "middle";
tdata2.align = "center";
var btn = document.createElement("BUTTON");
tdata2.appendChild(btn);
btn.id = "Abort";
btn.innerText = "Cancel";
statusMessageButton=true;
}
else
{
statusMessageButton=false;
}
document.body.appendChild(div);
StatusMsg.divObj = div;
},
ShowStatusMsg : function(cTop, cLeft)
{
if (StatusMsg.divObj)
{
if (typeof cTop == "undefined")
{
cTop = document.body.clientHeight / 2 - 35;
}

if (typeof cLeft == "undefined")
{
cLeft = document.body.clientWidth / 2 - 75;
}

StatusMsg.CreateIframeStatusMsg(cTop, cLeft, StatusMsg.divObj.clientHeight+5, StatusMsg.divObj.clientWidth+5)
StatusMsg.CreateStatusMsg(statusMessageString, statusMessageButton);
StatusMsg.divObj.style.top = cTop;
StatusMsg.divObj.style.left = cLeft;

StatusMsg.iframeObj.style.display = "block";
StatusMsg.iframeObj.style.visibility = "visible";
StatusMsg.iframeObj.style.zIndex = 19;

StatusMsg.divObj.style.display = "block";
StatusMsg.divObj.style.visibility = "visible";
StatusMsg.iframeObj.style.zIndex = 20;
}
},
HideStatusMsg : function()
{
if (StatusMsg.iframeObj)
{
StatusMsg.iframeObj.style.display = "none";
StatusMsg.iframeObj.style.visibility = "hidden";
}
if (StatusMsg.divObj)
{
StatusMsg.divObj.style.display = "none";
StatusMsg.divObj.style.visibility = "hidden";
}
}
}


por favor hazme saber si funciona :)
  #5 (permalink)  
Antiguo 11/01/2008, 05:45
 
Fecha de Ingreso: enero-2008
Mensajes: 8
Antigüedad: 17 años, 1 mes
Puntos: 0
Re: Mensaje de de espera...

Te funcionó loco?
  #6 (permalink)  
Antiguo 15/01/2008, 12:42
 
Fecha de Ingreso: abril-2001
Mensajes: 293
Antigüedad: 23 años, 9 meses
Puntos: 0
Re: Mensaje de de espera...

Hla estimado gracias por la respuesta y disculpa por no haber contestado, el mensaje funciona bien pero, por alguna razon lo lo despliega si no antes de haber cargado todo el xml no se porque?? entonces no alcanzar a verse el mensaje, lo probe solo habilitandolo y no lo escondo entonces ahi me di cuenta que lo muestra cuando la carga ya esta hecha y necesito mostrarlo cuando comience la cargo no se porque no funciona. alguna idea


saludos y muchas gracias
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 21:02.