Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/03/2010, 00:08
jeandybryan
 
Fecha de Ingreso: marzo-2010
Mensajes: 2
Antigüedad: 14 años, 2 meses
Puntos: 0
Respuesta: Cargar una pagina aspx en un div

Hace un tiempo me vi en la necesidad de implementar algo igual que lo planteado por usted.
Aquí le dejo un código completo de ejemplo espero que sea de ayuda.
Nota: Está probado en Internet explorer Y firefox


Código HTML:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>test</title>
	<script type="text/javascript">
        function AJAXCrearObjeto() {
            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 loadAspx(url, id) {
            var ajax = AJAXCrearObjeto();
            ajax.open("GET", url, "true");
            ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            ajax.send('null');
            var midiv = document.getElementById(id);

            ajax.onreadystatechange = function() {
                if (ajax.readyState == 4) {
                    midiv.innerHTML = ajax.responseText;
                    buscarInformacionHTML(midiv);
                }
            }	
        }
    </script>
</head>
<body>    
    <input type="button" value="Load aspx" onclick="loadAspx('test.aspx','web')" />
    <div id ="web"></div>
</body>
</html>