הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 26-08-08, 16:36   # 1
kfir91
חסום
 
מיני פרופיל
תאריך הצטרפות: Apr 2007
הודעות: 220

kfir91 לא מחובר  

עזרה ב ajax רענונים אוטומטים

הקוד js :
קוד:
function ajax_read() {
 if(window.XMLHttpRequest){
  xmlhttp=new XMLHttpRequest();
  if(xmlhttp.overrideMimeType){
   xmlhttp.overrideMimeType('text/xml');
  }
 } else if(window.ActiveXObject){
  try{
   xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  } catch(e) {
   try{
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

   } catch(e){
   }
  }
 }
 if(!xmlhttp) {
  alert('Giving up :( Cannot create an XMLHTTP instance');
  return false;
 }
 
 //document.getElementById("content").innerHTML ='reload..</h1>'
 
 xmlhttp.onreadystatechange = function() {
 if (xmlhttp.readyState==4) {
  document.getElementById("content").innerHTML = xmlhttp.responseText;
  }
 }
 xmlhttp.open('GET','test.php');
 xmlhttp.send(null);
 
}
function refresh()
{
 ajax_read()
 var t;
 t=setTimeout("refresh()",1000);
}
זה הדף refresh.js

ועכשיו זה הקוד של הדף test.php :
קוד:
<?
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header('Content-Type: text/html; charset=windows-1255');

include "config.php";
$result = mysql_query("SELECT * FROM result");
//$row = mysql_fetch_assoc($result);
?>
<html dir=rtl>
<head>
<title>בלה בלה</title>
<meta http-equiv="content-type" content="text/html; charset=windows-1255" />
<script type="text/javascript" src="instantedit.js"></script>
<script type="text/javascript" src="refresh.js"></script>
</head>
<body onload="refresh()">
<div id="content">
<table>
<? while ($row = mysql_fetch_assoc($result)) { ?>
<tr>
<td><span id="home-|||-<?php echo $row['id']; ?>" class="editText"><? echo $row['home']; ?></span></td>
</tr>
<?php } ?>
</table>
</div>
</body>
</html>
עכשיו תראו ככה זה לא עובד...
ושאני עושה
קוד:
<div id="content"></div>
שבפנים אין כלום זה כן עובד.. מה הקטע?

Last edited by kfir91; 26-08-08 at 16:53..
  Reply With Quote
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 01:25.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ