【发布时间】:2011-07-28 00:25:03
【问题描述】:
情况是,当我单击该行时,它会将我引导至“查看页面”,或者单击“更新按钮”会将我引导至“更新窗口”。现在我希望删除和更新按钮与名称和地址值在一行中。
我试过对齐,点击行没有问题,它引导我到“查看页面”但是每次我点击“更新按钮”时,它会弹出两个窗口,即“查看窗口” ”和“更新窗口”,其中它应该只是将弹出的“更新窗口”。
那么我怎样才能使更新页面不会影响查看页面。
这是我作品的链接图片:
(这还没有对齐,因为当我尝试时我遇到了上面的问题)http://www.fileden.com/files/2011/7/27/3174077/My_Documents/a.JPG
这是它的代码:
<link href="main.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Principal Page</title>
<script type="text/javascript">
function pop_up(id) {
var newWind = window.open( "view_principal.php?id="+id, "myWindow",
"status = 1, height = 200, width = 400, resizable = 0" );
}
function goModify(id)
{
window.location.href = "modify_principal.php?id=" + id;
}
function goDelete(id)
{
var answer = confirm ("Are you sure you want to delete?")
if (answer)
window.location.href = "delete_principal.php?id=" + id;
}
function ChangeColor(tableRow, highLight)
{
if (highLight)
{
tableRow.style.backgroundColor = '#66CCFF';
}
else
{
tableRow.style.backgroundColor = '#69F';
}
}
function DoLink(theUrl)
{
document.location.href = theUrl;
}
</script>
</head>
<body>
<p>
<?php
require_once ('include/config.php');
require_once ('include/opendb.php');
$query = mysql_query("SELECT * FROM principal");
echo "</br>";
echo "<br>";
echo "<div class='divMainTable'>";
echo "<table border='1' >
<tr class = 'headertable'>
<th width = '200'> Name</th>
<th> Address</th>
</tr>";
while($row = mysql_fetch_array($query)){
echo "<tr onclick = 'pop_up($row[principal_ID])');return false;' onmouseover='ChangeColor(this, true);' onmouseout='ChangeColor(this, false);'>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['address']."</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<div class='divSecondTable'>";
echo "<table class='updatetable' border='1'>";
echo "<tr class='dataTable'>";
echo "<td align='center'>"."<input type='button' name='update' value='Update'
onClick='goModify($row[principal_ID])');>"."</td>";
echo "<td align='center'>"."<input type='button' name='delete' value='Delete'
onClick='goDelete($row[principal_ID])');>"."</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
}
?>
<form id="form1" name="form1" method="post" action="add_principal.php">
<p class="add_option">
<input type="submit" name="add" id="button" value="ADD" />
</p>
</form>
</body>
</html>
【问题讨论】: