调用PHP上的超链接onclick事件的函数

can anybody help me here please? I am using AJAX for pagination in my application. So I am generating hyperlinks with for loop. as follow:

for($t=1; $t<=$hf; $t++)
{
   if($t == $_GET['pageno'])
   {    
       echo $t." ";
   }
   else
   {  
       echo "<a id ='$t' href='javascript:void(0)' onclick='open_page('ajaxinfo.php','content'); javascript:change('$t');'>$t</a>"." "; 
} 
 }

Above echo statement does not give call to function. But instead of this when i just write html hyperlink it works fine and I get to see page2.html, my HTML code is:

<a id="page2" href="javascript:void(0)" onclick="open_page('ajaxinfo.php','content'); javascript:change('page2');">page2</a>

I don't understand why this is so? But is there any problem in echo's quotes. Please Help.

that because you have syntax error while building anchors. Try to use double quotes for tag attributes and escape them with backslash.

So, your ECHO should look like this:

echo "<a id =\"{$t}\" href=\"javascript:void(0)\" onclick=\"open_page('ajaxinfo.php','content'); javascript:change('{$t}');\">{$t}</a> ";

You have to have code to add the contents returned by the ajax to the page. I don't see that anywhere.