Hej alle
Jeg sidder og leger lidt med noget javascript i min php.
men jeg får denne fejl: Out of memory in line: 11
Dette er den kode mit script producere:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Menu</title>
<script type="text/javascript" language="JavaScript">
<!--
var update;
var refresh;
function text() {
document.getElementById('text1').innerHTML='lollipop';//<Linje 11
document.getElementById('text2').innerHTML='hgdj';
document.getElementById('text3').innerHTML='fdgdgd';
document.getElementById('text4').innerHTML='gdhdh';
clearInterval(refresh);
chat_update();
refresh = setInterval('chat_update()', 500);
}
function chat_update(){
clearInterval(update);
text();
update = setInterval('text()', 3000);
}
-->
</script>
</head>
<body onload="chat_update()">
<span id="text1"></span><br>
<span id="text2"></span><br>
<span id="text3"></span><br>
<span id="text4"></span><br>
<span id="text5"></span><br>
<span id="text6"></span><br>
<span id="text7"></span><br>
<span id="text8"></span><br>
<span id="text9"></span><br>
<span id="text10"></span>
</body>
</html>
Og min kode:
<?
require("config/sql.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Menu</title>
<script type="text/javascript" language="JavaScript">
<!--
var update;
var refresh;
function text() {
<?
$sql = mysql_query("SELECT * FROM text");
$counter = 0;
while ($row = mysql_fetch_array($sql)) {
echo "document.getElementById('text".++$counter."').innerHTML='".$row[text]."';
";
}
?>
clearInterval(refresh);
chat_update();
refresh = setInterval('chat_update()', 500);
}
function chat_update(){
clearInterval(update);
text();
update = setInterval('text()', 3000);
}
-->
</script>
</head>
<body onload="chat_update()">
<span id="text1"></span><br>
<span id="text2"></span><br>
<span id="text3"></span><br>
<span id="text4"></span><br>
<span id="text5"></span><br>
<span id="text6"></span><br>
<span id="text7"></span><br>
<span id="text8"></span><br>
<span id="text9"></span><br>
<span id="text10"></span>
</body>
</html>
Håber der er nogle der kan sige mig hvad der er galt..
Link:
http://213.150.61.60/JavaScript/Hvis linket ikke virker er det fordi min server er slukket pga. problemmer.
--------------------------------------------------------
Husk altid: Google er din ven.