2013-05-01 56 views
-1

我有一個頁面,以獲得從遠程站點通過文件的源代碼獲取內容的PHP函數。它運行良好,獲得代碼並完美地迴應它。顯示一個TR和隱藏另一個在同一如果兩者都具有相同的類

的問題是,有2 <tr>具有類<tr class="sectiontableentry2">

當我試圖隱藏使用CSS display: none;其中之一,則兩個消失。

我想隱藏只是其中之一。

N.B:我沒有訪問代碼本身,因爲我從遠程站點得到它。

這裏是我得到的代碼:

<tbody> 
<tr class="sectiontableentry2"> 
<td width="18"><img title="Flash" src="../images/soft_icons/flash.png" alt="Flash" /></td> 
<td width="80"><a>Flash:</a></td> 
<td><a href="http://www.bet365.com/EXTRA/?ContentPath=LiveStreaming%252cStreaming&affiliate=365_057149" target="_blank">Link#1</a> (Stable, Recommended Stream!) <a href="http://www.streamhunter.eu/bet365-important-notice.html" onclick="window.open('http://www.streamhunter.eu/bet365-important-notice.html','notice','width=400,height=300');return false;"><img style="vertical-align:text-bottom;" src="http://www.streamhunter.eu/images/info-icon.png" border="0" alt="Important Notice!" title="Important Notice!" /></a></td> 
</tr> 
</tbody> 

<tr class="sectiontableentry2"> 
<td width="18"><img title="Iframe" src="../images/soft_icons/flash.png" alt="Flash" /></td> 
<td width="80"><a>Flash:</a></td> 
<td><a href='javascript:openWindow("index1.php?option=com_lsh&view=lsh&event_id=148636&tv_id=929&tid=32666&channel=0&tmpl=component&layout=popup&Itemid=335","730","730")' >Link#1</a> (640x360) </td> 
</tr> 
</tbody>`enter code here` 

正如你可以看到有兩個<tr>均具有相同的類。如何隱藏第一個,讓第二個正常顯示?

+0

編輯確實有很多的耐心! – 2013-05-01 05:21:25

回答

0

這很困難,因爲必須有更多的HTML沒有包含,但是如果只有兩個.sectiontableentry2類的實例,下面的JQuery代碼會找到第一個並隱藏它。

//this will select the first tr with the class .sectiontableentry2 
$(".sectiontableentry2").first().hide(); 
+0

看看我添加的代碼,我已經試過這個沒有運氣 – user2338253 2013-05-01 05:20:26

+0

這是奇怪的HTML格式。該tbody確實是格式錯誤...是否有HTML顯示。你在問關於使用JQuery隱藏tr嗎? – Matt 2013-05-01 05:26:49

+0

抱歉,這裏是FUL代碼http://pastebin.com/Sn1G678p – user2338253 2013-05-01 05:42:43

相關問題