2011-07-17 14 views
0

我使用PHP交替行:如何使用JavaScript onclick事件調用彩盒效果(實施例7)

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)嗎?

順便說一句,從顏色框實施例7可以在這裏找到:http://colorpowered.com/colorbox/core/example1/index.html

它的演示 「外網頁(I幀)」

回答

1

元素可以有多個類,

<tr class='even example7'> 

但你這裏不需要班級,直接撥打colorbox:

function DoNav(theUrl) 
{ 
    $.colorbox({href: theUrl, 
       iframe: true, 
       width: '80%', 
       height: '80%'}); 
} 
+0

謝謝莫爾博士! –

相關問題