var od="";
var odc="";
function cal_ajax_date(d,m,y)
{
if(d=="-")
return false;
else
{
var dt=y+"-"+m+"-"+d;
calendardateajax(dt);
if(od!="")
document.getElementById(od).className=odc;
odc=document.getElementById(dt).className;
document.getElementById(dt).className="cal_select";
od=dt;
return true;
}
}
What is the difference between first and below
var od="";
var odc="";
function cal_ajax_date(d,m,y)
{
if(d=="-")
return false;
else
{
var dt=y+"-"+m+"-"+d;
calendardateajax(dt); //this is another function which displays a data using ajax.php
if(od!="")
document.getElementById(od).className=odc;
alert(dt);
odc=document.getElementById(dt).className;
document.getElementById(dt).className="cal_select";
od=dt;
return true;
}
}
Don't say alertbox. I am asking what is the other difference because when i have
<?php
$d=date("j",time());
$m=date("n",time());
$y=date("Y",time());
echo "
<script type=text/javascript>
window.onload=cal_ajax_date($d,$m,$y)
</script>";
?>
this in the main script i get
1st code: Error
document.getElementById(dt) is null
cal_ajax_date(1, 7, 2009)
(?)()
odc=document.getElementById(dt).className;
2nd code: It works fine as i wanted (actually i don't want the alertbox)
I don't understand where the mistake is
Somebody Help me Please