我有一个使用 PHP 的交替行:
while($i < $num)
{
$idphysicians = mysql_result($qPhysician,$i,"idphysicians");
if ($i % 2 == 0){
echo "<tr class='even' onclick=\"DoNav('physicianUpdate.php?idphysicians=$idphysicians');\">";
}
else{
echo "<tr class='odd' onclick=\"DoNav('physicianUpdate.php?idphysicians=$idphysicians');\">";
}
echo "<td>" . mysql_result($qPhysician,$i,"lastName") . "</td>";
echo "<td>" . mysql_result($qPhysician,$i,"firstName") . "</td>";
echo "</tr>";
我调用了 DoNav javascript 函数以在单击我的表中的行时打开链接:
function DoNav(theUrl)
{
document.location.href = theUrl;
}
我还有一个彩盒效果,可以使用 ahref 链接添加另一位医生。这个有效:
<a class='example7' href="physicianAdd.php" title="Add a Physician"><img src="images/icons/add.png" height="20"/> Add a Physician</a>
如何为上面的可点击表格行添加相同的颜色框效果?由于我已经有一个 tr 类 even 或 odd,我还可以向它添加另一个类(example7)吗?
顺便说一下,colorbox 中的 example7 可以在这里找到:http://colorpowered.com/colorbox/core/example1/index.html
这是演示“外部网页(Iframe)”
最佳答案
元素可以有多个类,
<tr class='even example7'>
不过这里不需要类,直接调用colorbox即可:
function DoNav(theUrl)
{
$.colorbox({href: theUrl,
iframe: true,
width: '80%',
height: '80%'});
}
关于javascript - 如何用javascript onclick事件调用Colorbox效果(例7),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6722474/