可以用全局变量来记录..var nIndex = 0; //全局变量//调用前清0
nIndex = 0;
$("p").click(function()
{
    nIndex++;
    alert(nIndex);
})