You are on page 1of 2

ajax.js view plaincopy to clipboardprint? function GetXMLHttp() { if(navigator.appName == "Microsoft Internet Explorer") { xmlHttp = new ActiveXObject("Microsoft.

XMLHTTP"); } else { xmlHttp = new XMLHttpRequest(); } return xmlHttp; } var xmlRequest = GetXMLHttp();

No arquivo instrucao.js ter as informaes necessrias para fazer a ao instrucao.js view plaincopy to clipboardprint? function abrirPag(valor){ var url = valor; xmlRequest.open("GET",url,true); xmlRequest.onreadystatechange = mudancaEstado; xmlRequest.send(null); if (xmlRequest.readyState == 1) { document.getElementById("conteudo_mostrar").innerHTML = "<img src='loader.gif'>"; } return url; } function mudancaEstado(){ if (xmlRequest.readyState == 4){ document.getElementById("conteudo_mostrar").innerHTML = xmlRequest.responseText; } }

Criamos a pgina Index.html para recerber as informaes

Index.html view plaincopy to clipboardprint? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Carregando Pgina em DIV / AJAX</title> <script language="javascript" src="ajax.js"></script> <script language="javascript" src="instrucao.js"></script> </head> <body> <div id="menu"><a href="#" onclick="abrirPag('Conteudo.html');">Clientes</a></div> <br><br> <div id="conteudo_mostrar"></div> </body> </html>

E finalmente criamos a pgina Conteudo.html que ser exibida dentro da DIV conteudo_mostrar Conteudo.html view plaincopy to clipboardprint? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Clientes</title> </head> <body> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </body> </html> Qualquer dvida postem!! Abraos!!!!

You might also like