hai all, i want to refresh particular part of the page ,not whole page. is it possible? . if so, how is it? .........

hai all, i want to refresh particular part of the page ,not whole page. is it possible? . if so, how is it? .........

fairly simple task with ajax and javascript... google for its tutorials.

hai all, i want to refresh particular part of the page ,not whole page. is it possible? . if so, how is it? .........

iframes or ajax

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript" src="myajax.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
  <p>
   <input type="text" name="name" id="name"   onkeyup="ajaxFunction()" />
 </p>
 <div id="showmessage"> </div>
</form>
</body>
</html>

myajax.js

function ajaxFunction()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
  document.getElementById("showmessage").innerHTML=xmlhttp.responseText;
  }
}
var url=document.form1.name.value
var url="my.php?q="+url;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

my.php

<?php 
$q=$_GET["q"];
include("config.php");
global $conn;
$sql="SELECT FirstName FROM user_register WHERE user_id ='".$q."'";
$resultqvu = mysql_query($sql,$conn);
$row=mysql_fetch_array($resultqvu);
$n=mysql_num_rows($resultqvu);

if($n!=0)
{
    echo "Student Name--".$row[0];
}
else{echo "Invalid Student";}
mysql_close($conn);
?>

ajax is gr8

i want to refresh part of the page every 3seconds. how to do this task. give me idea!!!

i want to refresh part of the page every 3seconds. how to do this task. give me idea!!!

function refreshiframe()
{
parent.iframeid.location.href="thepage.com"
setTimeout("refreshiframe()", 2700000);
}
function refreshiframe()
{
parent.iframeid.location.href="thepage.com"
setTimeout("refreshiframe()", 2700000);
}

actualy i dont know how to use iframes. where should i put these code in my page. i am using <div>'s.

actualy i dont know how to use iframes. where should i put these code in my page. i am using <div>'s.

you want to refresh the part of the page and you using div structure , that means you want to refresh some div entirely.so iframe inside that div.

you want to refresh the part of the page and you using div structure , that means you want to refresh some div entirely.so iframe inside that div.

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
   function refreshiframe()
   {
   parent.iframeid.location.href="refresh.php"
   setTimeout("refreshiframe()", 2700000);
   }
</script>
</head>
<body>
<div>
<iframe id="iframeid" name="iframeid" >
<img src="Blue hills.jpg" width="100" height="100"  />
</iframe>
</div>
</body>
</html>

it is not working, even not display the images also.

are you trying to create the animation effect with this, then you should think of some other way for creating animation -
Either this is not working too, though the status bar is blinking continuosly.

<HTML>
<HEAD>
<script LANGUAGE="JavaScript">
<!--
function reloadImg(){
 uniq = new Date();
 uniq = "?"+uniq.getTime();
 newImage = document.images['imgToLoad'].src;
 index = newImage.indexOf("?", 0);
  if(index > 0){
    newImage = newImage.substr(0, index);
  }
 document.images['imgToLoad'].src = newImage+uniq;
 setTimeout('reloadImg()', 3);
}
// -->
</script>
</HEAD>
<body onload="reloadImg()">
<a href="" >
<img src="http://blog.themeforest.net/wp-content/themes/marketplace/images/woods/footer-logo.gif"  height="41" width="127" name="imgToLoad"></a>
</body></html>

are you trying to create the animation effect with this, then you should think of some other way for creating animation -
Either this is not working too, though the status bar is blinking continuosly.

<HTML>
<HEAD>
<script LANGUAGE="JavaScript">
<!--
function reloadImg(){
 uniq = new Date();
 uniq = "?"+uniq.getTime();
 newImage = document.images['imgToLoad'].src;
 index = newImage.indexOf("?", 0);
  if(index > 0){
    newImage = newImage.substr(0, index);
  }
 document.images['imgToLoad'].src = newImage+uniq;
 setTimeout('reloadImg()', 3);
}
// -->
</script>
</HEAD>
<body onload="reloadImg()">
<a href="" >
<img src="http://blog.themeforest.net/wp-content/themes/marketplace/images/woods/footer-logo.gif"  height="41" width="127" name="imgToLoad"></a>
</body></html>

actualy i want to display images one by one . when i refresh the page image must be change. i am fetching image from db.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.