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

标签 javascript colorbox

我有一个使用 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/

相关文章:

javascript - 检查有多少选择使用 jQuery 选择了选项

javascript - 如何从 router.push 获取数据并在另一个组件中使用它

jquery - 从 colorbox 内的表单序列化帖子

javascript - 是否可以将图像添加为 Logo 颜色框

drupal - 在彩盒中显示评论表和其他信息以及图像

javascript - Javascript/Angularjs 中数字的平均值

javascript - 自引用对象在 JavaScript 函数中如何工作?

javascript - 将文档添加到 mongodb,并预先填充字符串的开头和结尾

jquery - MediaWiki:仅获取内容

asp.net - ColorBox(jquery 插件)回发后我的文本框值为空