我有一个从 mysql 数据库检索数据后创建表的页面。每行都有一个链接。我的问题是我必须在单击链接的行的第一个单元格中传递文本(这是我也将在弹出窗口中使用的主键)。
<TABLE border="1" height="800px" width="600px" id="myTable">
<br>
<br>
<caption>*Please close or update the following WAR first!</b></caption>
<br>
<th><center><b>Weekly Report ID</b> </center></th>
<th><center><b>Report Category</b> </center></th>
<th><center><b>Problem Title</b> </center></th>
<th><center><b>Closure</b> </center></th>
<th><center><b>Action</b> </center></th>
<?php
while ($row = mysql_fetch_array($result))
{
$rptid = $row['weeklyReportId'];
$rptcat = $row['reportCategory'];
$rptptl = $row['problemTitle'];
$rptcls = $row['closure'];
?>
<tr>
<td width="50"><?php echo $rptid; ?></td>
<td width="50"><?php echo $rptcat; ?></td>
<td width="50"><?php echo $rptptl; ?></td>
<td width="20"><?php echo $rptcls; ?></td>
<td width="20"><a href="#"><img src="../MyImages/Text Edit Icon.jpg" width="15" height="15" onClick="return popitup('update_popup.php'); "></img> </a></td>
<!--<td width="10"> <input type="image" src="../MyImages/Text Edit Icon.jpg" width="15" height="15" id="target"></input></td>-->
</tr>
<?php
}
mysql_free_result($result);
mysql_close($dbhandle);
?>
</TABLE>
我还有一个 Javascript 可以打开弹出窗口
<!-- Function for popup window
var newwindow;
var def1='';
function popitup(url,name) {
newwindow=window.open(url,'name','height=500,width=800');
if (window.focus) {newwindow.focus()
}
return false;
}
// -->