echo "<table>";
echo "<tr><td>id</td><td>pwd</td><td>操作</td></tr>";
while($row)               //$row从数据库中取出记录
{
  echo "<tr><td>$row[id]</td><td><input type=text id='pwd$row[id]' value=$row[pwd]></td>";
  echo "<td><a href=# onclick='run(this.id,$row[id])' id='keep'>修改</a></td>";
  echo "<input type=hidden id='id' value=$row[id]></tr>";
}
echo "</table>";
echo "<div id=info></div>";
加入红色部分然后run()函数改如下:
function run(id,str)

    xmlHttp=GetXmlHttpObject();           //调用GetXmlHttpObject()创建一个XMLHTTP对象
     var pwd=document.getElementById("pwd"+id).value;
    var url="insert.php";                    //在insert.php上处理数据                    
    url=url+"?str="+str+"&id="+id+"&pwd="+pwd;                     
    url=url+"&sid="+Math.random();                              
    xmlHttp.open("GET",url,true);                                
    xmlHttp.send(null);                                           
    xmlHttp.onreadystatechange = function()
        {
            if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") 
            { 
                                //标签名为info
                document.getElementById("info").innerHTML=xmlHttp.responseText;
            }        
        }
}
这样基本就可以了