日期:2014-05-16 浏览次数:20526 次
function popUserDetail(x,y){ var popUp = document.getElementById("popUserDetail"); popUp.style.top="100px"; popUp.style.left="150px"; popUp.style.width="200px"; popUp.style.height="100px"; popUp.style.visibility="visible"; alert(y.rowIndex); alert(x); }
while ($records = mysql_fetch_array($rows)) { $arr = ct($records['uniqueid']); $fileLastUploadTime = $arr[1]; print '<table id="tb2"> <tr onclick="popUserDetail('.$records["uniqueid"].',this)" onmousemove="hidePopUserDetail()"> <td width="40px">'.st($records['lastT'],$fileLastUploadTime).'</td> <td width="100px">'.$records['barName'].'</td> <td width="160px">'.$records['lastLogin'].'</td> <td width="160px">'.date("Y-m-d H:i:s",$arr[1]).'</td> <td width="150px">'.$records['endTM'].'</td> <td width="40px">'.$arr[0].'</td> <td width="40px">'.$records['version'].'</td> </tr> </table>'; }
<!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=utf-8" /> <title>无标题文档</title> </head> <body> <!--表1具有一行二列--> <table width="500" border="1"> <tr> <td> </td> <td> </td> </tr> </table> <!--表2具有二行二列--> <table width="500" border="1"> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <script type="text/javascript"> //获取所有的tr节点,两个表格加起来一共有3行 var obj = document.getElementsByTagName('tr'); //遍历输出各行的rowIndex for (var i = 0; i < obj.length; i ++) alert(obj[i].rowIndex); /*运行结果: 0 -- 第一个表格的第0行 0 -- 第二个表格的第0行 1 -- 第二个表格的第1行 */ </script> </body> </html>