Ver Mensaje Individual
  #6 (permalink)  
Antiguo 01/10/2007, 08:56
Avatar de Gaby_Corr
Gaby_Corr
 
Fecha de Ingreso: junio-2005
Mensajes: 672
Antigüedad: 19 años, 10 meses
Puntos: 0
Re: problema con div que no refresca mi pagina

bueno, el codigo de ajax si sirvio =), solo que teng una gran duda

tengo una pag principal que se llaama comercial.asp, en esta pag es donde esta la funcion de "des-esconder" divs,

function show_cblistapre()
{
limpia();
document.getElementById("contentb1").style.display = "block";
}

cuando aparezco un div mando llamar la pagina baslistapre.asp de esta forma:

<div id="contentb1" style=" display: none;"><% Server.Execute("baslistapre.asp")%></div>


** el codigo anterior esta dentro de mi pagina comercial.asp **

dentro de baslistapre.asp puse el codigo ajax que me pasaron, de esta forma :

Código:
<html>
<head>
<script language="javascript" type="text/javascript">
function handleHttpResponse() {
    if (http.readyState == 4) {
       if (http.status == 200) {
          if (http.responseText.indexOf('invalid') == -1) {
             results = http.responseText.split(",");
             document.getElementById("mostrar").innerHTML = results;
             enProceso = false;
          }
       }
    }
}

function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; }
       }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       try {
          xmlhttp = new XMLHttpRequest();
       } catch (e) { xmlhttp = false; }
    }
    return xmlhttp;
}

function MostrarContenido(pagina) {
    if (!enProceso && http) {
       http.open("POST", pagina, true);
       http.onreadystatechange = handleHttpResponse;
       enProceso = true;
       http.send(null);
    }
}

var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest

</script>

</head>


<body>
<%

dim PathFTP1, PathFTP2
dim urlFTP1, urlFTP2

PathFTP1 = "C:\Inetpub\wwwroot\sitiodistribuidores\Comercial\Basico\ListadePrecios\Licenciamiento"
PathFTP2 = "C:\Inetpub\wwwroot\sitiodistribuidores\Comercial\Basico\ListadePrecios\Servicios"

urlFTP1 = "./comercial/Basico/ListadePrecios/Licenciamiento/"
urlFTP2 = "./comercial/Basico/ListadePrecios/Servicios/"

Function LeerFolder(PathFTP, urlFTP)

Dim fso 
Set fso = CreateObject("Scripting.FileSystemObject")

	dim tmpArchivos, file, Contador, urlfile, directo, folderUsuario, ArchivosUsuario

	Set folderUsuario = fso.GetFolder(PathFTP)
	Set	ArchivosUsuario =  FolderUsuario.files

	tmpArchivos = ""
	Contador = 1
	For Each file in ArchivosUsuario 
	urlfile = urlFTP & File.name
		
		    tmpArchivos = tmpArchivos & "    <tr>"
			tmpArchivos = tmpArchivos & "    <td><ul><li class=""doc""><a href=""" & urlfile & """><b>" & File.name  &  "</a></b></li></td></tr>"
			tmpArchivos = tmpArchivos & "    <tr><td><div style="" margin-left: 30px;"">Fecha: " & File.datecreated & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tamaño: "
			tmpArchivos = tmpArchivos &  Formatnumber(File.Size / 1048576, 2) & " MB</div></td></tr>"
			tmpArchivos = tmpArchivos & "  </tr>"
			Contador = Contador + 1
    next
	
	if tmpArchivos = "" then
		tmpArchivos = "<tr><td colspan=4 align=center><b><br>Carpeta vacia<br><br></b></td></tr>"
	end if
	leerfolder = tmpArchivos
	
end function


%>
<table border="0" cellpadding="0" cellspacing="0">
	<tr>
	<td>
		<table cellpadding="0" cellspacing="0" width="262">
		<tr><td>
			<ul>
			  <li class="doc"><a href="#" onclick="MostrarContenido('blprelic.asp')" >Licenciamiento</a></li>
			  <li class="doc"><a href="#" onclick="MostrarContenido('blpreser.asp')" >Servicios</a></li>
		   </ul>
		</td></tr></table>	
	</td>
	<td> <div id="mostrar"></div></td>
	</tr>		
</table>

</body>
</html>
ahora bien , no entendi bien lo que dice shiryu_libra de combinar este ajax con la mostrada del div, si yo lo tengo en paginas distintas =S
__________________
" Recuerda , estas donde debes estar ..."