captar o código de outro ficheiro
Olá eu tenho o seguinte código para ver o conteudo de outra página mas só está aparecendo o cabeçalho:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml"](http://www.w3.org/1999/xhtml) >
<head runat="server">
<title>teste</title>
<script type="text/javascript" language="javascript">
function alteraURL(url){
try{
xmlhttp = new XMLHttpRequest();
}catch(ee){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttp = false;
}
}
}
if(xmlhttp.readyState == 4 || xmlhttp.readyState == 0)
{
xmlhttp.open("GET", url, true);
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 1)
{
document.getElementById("urlContent").value = "carregando...";
document.getElementById("carregando").value = "<img src='carregando.gif'>";
}
if(xmlhttp.readyState == 4)
{
document.getElementById("urlContent").value = xmlhttp.responseText;
}
}
xmlhttp.send(null);
}
}
</script>
</head>
<body onload="alteraURL('teste.htm')">
<form id="form1" runat="server">
<div>
<asp:Image ID="carregando" runat="server" Width="199px" />
<asp:TextBox ID="urlContent" runat="server" Height="388px" Width="629px"></asp:TextBox></div>
</form>
</body>
</html>
aparece o seguinte no urlContent:
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"
Discussão (3)
Carregando comentários...