onload加载两个函数是出错,单击事件停不下来,怎么办?

为了填充初始页面的数据,我写了2个js函数,一个设置表单默认值,一个自动点击按钮以计算结果,但是两个函数同时放到onload后面就出错了,不知道问题出在哪里,请帮忙看看,

<!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=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
function setval(){
var gd = document.getElementById("gaodu").value;
var kd = document.getElementById("kuandu").value;
var sl = document.getElementById("shuliang").value;
if(gd=="")
document.getElementById("gaodu").value=1600;
if(kd=="")
document.getElementById("kuandu").value=600;
if(sl=="")
document.getElementById("shuliang").value=1;
}
function danji(){
document.getElementById("sub").click();
}
</script>
</head>
<?php  
     $gaodu=$_GET["gaodu"];
     $kuandu=$_GET["kuandu"];
     $shuliang=$_GET["shuliang"];
?>     
<body onload="setval();danji()">  
<form action="">  
<input name="gaodu" id="gaodu" type="text" value="<?php echo $gaodu ?>"> 
<input name="kuandu" id="kuandu" type="text" value="<?php echo $kuandu ?>">
<input name="shuliang" id="shuliang" type="text" value="<?php echo $shuliang ?>"> 
<input name="sub" id="sub" type="submit"  value="计算">
</form>
<table width="200" border="1">
  <tr>
    <td><?php echo $gaodu+$kuandu ?></td>
  </tr>
</table>

</body>  
</html>


 <body onload="fun1()"> 

在你的js里面加上
function fun1()
{
setval();danji();
}

出错?出什么错?你放dianji在 onload里面就会不停的提交表单了。。,除非你提交到另外一个php页面而不是当前的页面,你的action为空就会提交到当前页面

有没有什么办法可以让php代码自动执行呢?

好像ajax可以局部刷新?谁能指点一下……。