on body load it is getting value of function tryt2(l)
but iwant that on body load it get both function value
and onclick i want to play animation.gif while getting data from 001.php but after getting data img will be removed
plz tell me ASAP
<html>
<head>
<script type="text/javascript">
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");
}
function tryt(l)
{
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","001.php?q=1 & l="+l,true);
xmlhttp.send();
}
function tryt2(l)
{
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv2").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","001.php?q=2 & l="+l,true);
xmlhttp.send();
}
function yourFunction(){
tryt();
tryt2();
}
</script>
</head>
<body onLoad="yourFunction()">
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onClick="tryt(this.value)" value="1">Change Content</button>
<div id="myDiv2"><h2>Let AJAX2 change this text</h2></div>
<button type="button" onClick="tryt2(this.value)" value="2">Change Content</button>
</body>
</html>