传递on on on函数

Hie all, Here is my code part.page1.php

<?php
$ID="1,2,3,4,";
$ID1=json_encode($ID);
?>
<html>
<script src="page.js" type="text/javascript"></script>
<body onload="<?php echo'add('.$ID1.')';?>">
</body>
</html>

//page.js code
function add(oi1)
{
alert(oi1);
}

It gives me syntax error near add(.. I want to pass "1,2,3,4,"; on add function.

Try:

<body onload="add('<?php echo $ID1?>')"> 

It's often better writing like this instead of your example.