2014-10-05 29 views
0

我有這樣的一個表一個jsp:從排在HTML中獲得價值,並用它在JSP

<table style="width:100%"> 
    <thead> 
    <tr> 
     <th>ID</th> 
     <th>Name</th> 
     <th>Adress</th> 
    <tr> 
    </thead> 
    <tbody> 
    //here is a loop filling the table 
    <tr data-toggle="modal" data-target="#modal"> 
     <div> 
      <td>${id}</td> 
      <td>${name}</td> 
      <td>${adress}</td> 
     </div> 
    <tr> 
    </tbody> 
</table> 

所以我想用從表中的id模式(這是一個彈出對話框)獲取一些信息,但我無法獲取用戶正在按的行的值。 任何幫助將有所幫助。

回答

0

我建議使用JavaScript來做到這一點。您可以將onclick事件添加到您的div,該行的ID作爲參數傳遞給javascript函數。然後,該功能並打開模式對話框。

<div onclick="openPopup(${id})">