2014-12-19 44 views
0

簡介: 我是JQuery的新手,需要在其中實現一個場景,即單擊時添加少量行並刪除雙擊上添加的行單擊。在單擊時添加幾行並在雙擊上刪除添加的行

完成方案: 我在頁面中有兩個表格,即頂層父表格和下面的子表格。 父表中有行需要點擊或雙擊。 方案: 1)首要條件是,在父表的任何行上每次單擊時,應在下面的子表中添加5行,即如果在行號3上有5次單擊,則總共25行應該是添加到子表中。 2)第二個要求是,每雙擊父表的任意行,在父表的行上單擊添加的所有相應的行應該被刪除,即如果行號3被雙擊,所有25行分別對應行號3加入,子表中應刪除。

需要幫助解決相同的問題。

HTML Code: 
 

 
<div style="overflow: scroll; width: 1455px;height:175px;" class="tree"> 
 
\t \t <table class="boldtable" id="packagelisttable" style="width: 100%"> 
 

 
\t \t \t <caption> 
 
\t \t \t \t <b style="font-size: 20px">Package List</b> 
 
\t \t \t </caption> 
 
\t \t \t <tr class="tableHeaderRow"> 
 
\t \t \t \t <th class="columnHeader">Distributable Name</th> 
 
\t \t \t \t <th class="columnHeader">Version</th> 
 
\t \t \t \t <th class="columnHeader">Modality</th> 
 
\t \t \t \t <th class="columnHeader">Machine Name</th> 
 
\t \t \t \t <th class="columnHeader">Machine Type</th> 
 
\t \t \t \t <th class="columnHeader">Machine Version</th> 
 
\t \t \t \t <th class="columnHeader">Machine Version2</th> 
 
\t \t 
 

 
\t \t \t \t <th class="columnHeader">Last Registered By </th> 
 
\t \t \t \t \t <th class="columnHeader">Last Registered On </th> 
 
\t \t \t </tr> 
 

 

 

 
\t \t \t <tr class="lightData"> 
 
\t \t \t \t <td class="columnHeader">Installer1</td> 
 
\t \t \t \t <td class="columnHeader">1</td> 
 
\t \t \t \t <td class="columnHeader">CT1</td> 
 
\t \t \t \t <td class="columnHeader">ABCD</td> 
 
\t \t \t \t <td class="columnHeader">Dell</td> 
 
\t \t \t \t <td class="columnHeader">1</td> 
 
\t \t \t \t <td class="columnHeader">1</td> 
 

 

 
\t \t \t \t <td class="columnHeader">User </td> 
 
\t \t \t \t \t <td class="columnHeader">11-10-2014 </td> 
 

 

 
\t \t \t </tr> 
 

 
\t \t \t <tr class="darkData"> 
 
\t \t \t \t \t \t \t <td class="columnHeader">Installer2</td> 
 
\t \t \t \t <td class="columnHeader">1</td> 
 
\t \t \t \t <td class="columnHeader">CT1</td> 
 
\t \t \t \t <td class="columnHeader">PQRS</td> 
 
\t \t \t \t <td class="columnHeader">Dell</td> 
 
\t \t \t \t <td class="columnHeader">1</td> 
 
\t \t \t \t <td class="columnHeader">1</td> 
 

 

 
\t \t \t \t <td class="columnHeader">User </td> 
 
\t \t \t \t \t <td class="columnHeader">14-10-2014 </td> 
 

 
\t \t \t </tr> 
 
\t \t </table> 
 

 

 

 
\t </div> 
 

 
</div>

+0

你有什麼企圖?你的html是什麼樣的? – Brian 2014-12-19 05:46:07

+2

@nish是否將項目分配給SO用戶,如果不是,則顯示您的代碼以便我們可以幫助您。 – 2014-12-19 05:49:21

+0

爲了將來的參考,您不需要在標題中加入標籤。 http://meta.stackexchange.com/questions/19190/should-questions-include-tags-in-their-titles – Brian 2014-12-19 05:50:21

回答

1
$("#buttonid").click(function() { 

//你的代碼 });

$("#buttonid").dblclick(function() { 

//你的代碼 });

+0

不要僞造包含jquery庫。祝你好運 – 2014-12-19 06:26:09

相關問題