Tuesday, January 22, 2008

Ajax & OOPs Concept

class test
{
var $myvar;
function test($param)
{
$this->myvar = $param;
}
//function _construct()
//{
// $this->$myvar = $param;
//}
function myfunction($mvar)
{
echo "
Execute MyFunction".$mvar;
return;
}
}

$obj = new test("20");
echo $obj->myvar;
$obj->myfunction("10");

?>





*********************** AJAX ***************




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">

var http = false;



if(navigator.appName == "Microsoft Internet Explorer")

{

http = new ActiveXObject("Microsoft.XMLHTTP");

}

else

{

http = new XMLHttpRequest();

}

var ajax;

function replace() {



//document.getElementById('mymap').innerHTML = "Hello, <b>AJAX</b> world!";

//ajax= new Ajax.Updater('mymap','locinfo.php',(method:'get'));

http.abort();

http.open("GET", "locinfo.php", true);

http.onreadystatechange=function() {

if(http.readyState == 4) {

document.getElementById('mymap').innerHTML = http.responseText;

}

}

http.send(null);

window.setTimeout('replace()',5000);

}

//window.setTimeout('replace()',2000);



</script>

<link rel="stylesheet" href="../include/menu4.css" type="text/css" />

</head>

<body onLoad="javascript:replace()">



<div id="mymap" >

GREEN START

</div>





</body>

</html>

 

No comments: