如何使用javascript onclick事件调用Colorbox效果(示例7)

How to call Colorbox effect (example7) with javascript onclick event

本文关键字:效果 示例 Colorbox 调用 何使用 javascript onclick 事件      更新时间:2023-09-26

我有一个交替行使用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;
  }

我也有一个colorbox效果来添加另一个医生使用ahref链接。

<a class='example7' href="physicianAdd.php" title="Add a Physician"><img src="images/icons/add.png" height="20"/> Add a Physician</a>

我如何添加相同的colorbox效果到我的点击表行上面?因为我已经有一个tr类偶数或奇数,我还可以添加另一个类(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%'});
}