Retroceder   Foros del Web > Programación para sitios web > AJAX

Respuesta
 
Herramientas Desplegado
Antiguo 13-may-2008, 21:47   #1 (permalink)
neland92 ha deshabilitado el karma
 
Fecha de Ingreso: mayo-2008
Mensajes: 6
Triste mensaje = Resource id #3

Nose ni entiendo por que me sale este mensaje => Resource id #3
Estoy aprendiendo AJAX de un libro. Este es el codigo:

1er archivo news.php

<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script language="JavaScript">
function xmlhttpPost(strURL)
{
var xmlHttpReq=false;
var self = this;
if (window.XMLHttpRequest)
{ self.xmlHttpReq = new XMLHttpRequest(); }
else if (window.ActiveXObject)
{ self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); }
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() //aqui tenia unas mayusculas
{
if (self.xmlHttpReq.readyState == 4)
{ updatepage(self.xmlHttpReq.responseText); }
}
self.xmlHttpReq.send(getquerystring());
}

function getquerystring()
{
var form = document.forms['editform'];
var news = form.news.value;
qstr = 'article=' + escape(news);
return qstr;
}

function updatepage(str)
{
document.getElementById("resultado").innerHTML = str;
document.getElementById("mensaje").innerHTML = "ACTUALIZADO";
}

</script>

<style>
body, p, input, textarea, div {font: bold 8pt verdana, sans-serif;}
a, span {
font: bold 8pt verdana, sans-serif;
text-decoration:none;
color:red;
}
</style>

</head>

<body>

<div id="resultado">
<?
$news="news.txt";
$text= fopen ($news,'r');
$content=fread($text,filesize($news));
fclose($text);
echo($content);
?>
</div>
<i>Actualizacion</i>
<form name="editform" method=post>
<textarea name="news" cols=50 rows=35 wrap=soft>
<? echo($content); ?>
</textarea>
<input value="Actualizar" type="button" onClick='javascript:xmlhttpPost("writer.php")'>
</form>
<span id="mensaje"></span>
</body>
</html>


2do Archivo writer.php

<?

$bulletin="news.txt";
$text=fopen($bulletin, 'w') or die("falta archivo");
$article=utf8_encode($text);
$article=utf8_decode($text);
$article=stripslashes($text);
$article=htmlentities($text);
$article=str_replace('&gt;','>',$text);
$article=str_replace('&lt;','<',$text);
fwrite($text,$article);
fclose($text);
$news="news.txt";
$text=fopen($news,'r');
$content=fread($text,filesize($news));
fclose($text);
echo($content);

?>

El archivo news.txt puede tener cualquier informacion.
Gracias de antemano y espero que me puedan ayudar.
neland92 está desconectado   Responder Citando
Respuesta

No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 21:26.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93