2013-02-22 94 views
0

我想要一個表格右邊的圖片。把一個img放在一張表的右側#版本2

這裏是我想要的(油漆一樣):

enter image description here

這裏是我的html:(並不關心, 「如果」,在 「JSP」)。 例如代碼的最後一行(「如果」後):<td class="noborder"><img src="img/refresh.png" class="refreshButton" alt="Refresh" id="sameRightsAsRefresh" href="Javascript:void;"></img></td>

這裏是CSS:

table td,table th 
{ 
    border: 1px ridge black; 
    padding: 3px; 
} 

td.noborder { 
    border:0 
} 

我希望有我的按鈕刷新在SameRightsAs,用戶名的右側,姓。

的完整代碼:

<!-- FIRST TABLE : REQUESTOR --> 
      <form id="form" method="post" action="mainServlet?command=FillBlanks&amp;"> 
       <p class="tableHead">Request For:</p> 
       <table class="requestor"> 

        <tr> 
         <td class="reqCellLabel">Username:</td> 
         <td class="reqCellAnswer" id="oracleUsername"><input id="oracleUsernameText" class="reqCellAnswer" onchange="fillBlanks(this.id,this.value)" 
          type="text" name="Requestor" <%if(Integer.parseInt(request.getParameter("isCreation")) == 1){%> readonly <%}%>></input></td> 
        </tr> 
        <tr> 
         <td class="reqCellLabel">Oracle Employee #:</td> 
         <td class="reqCellAnswer" id="oracleEmployeeNumber"><input id="oracleEmployeeNumberText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
        </tr> 
        <tr> 
         <td class="reqCellLabel">Last name:</td> 
         <td class="reqCellAnswer" id="lastName"><input id="lastNameText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
        </tr> 

        <tr> 
         <td class="reqCellLabel">First name:</td> 
         <td class="reqCellAnswer" id="firstName"><input id="firstNameText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
        </tr> 

        <tr> 
         <td class="reqCellLabel">Timezone:</td> 
         <td class="reqCellAnswer" id="timeZone"><input id="timeZoneText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
        </tr> 

        <tr> 
         <td class="reqCellLabel">Default Printer:</td> 
         <td class="reqCellAnswer" id="defaultPrinter"><input id="defaultPrinterText" class="reqCellAnswer" 
          type="text" name="Requestor" value=""></input></td> 
        </tr> 
        <tr> 
         <td class="reqCellLabel">Employee is a buyer ?</td> 
         <td class="reqCellAnswer" id="employeeIsBuyer"><input id="employeeIsBuyerText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
        </tr> 
        <tr> 
         <td class="reqCellLabel">Same rights as :</td> 
         <td class="reqCellAnswer" id="sameRightsAs"><input id="sameRightsAsText" name="sameRightsAsText" class="reqCellAnswer" onchange="sameRightsAs(this.id,this.value)" 
          type="text" name="Requestor" <%if(Integer.parseInt(request.getParameter("isCreation")) == 0){%> disabled <%}%>></input></td> 
         <%if(Integer.parseInt(request.getParameter("isCreation")) == 1){%> <td class="noborder"><img src="img/refresh.png" class="refreshButton" alt="Refresh" id="sameRightsAsRefresh" href="Javascript:void;"></img></td><%}%> 
        </tr> 
       </table> 

      </form> 
</body 

回答

0

這樣的事情? 講究,所有的文本字段具有相同的名稱,當你提交表單的最後一個將是公認的價值,但也許就是一個例子,我希望:)

<table class="requestor"> 

        <tr> 
         <td class="reqCellLabel">Username:</td> 
         <td class="reqCellAnswer" id="oracleUsername"><input id="oracleUsernameText" class="reqCellAnswer" onchange="fillBlanks(this.id,this.value)" 
          type="text" name="Requestor"></input></td> 
         <td class="noborder" id="oracleUsername"><img src="refresh.jpg" width="16" height="16" /></td> 
        </tr> 
        <tr> 
         <td class="reqCellLabel">Oracle Employee #:</td> 
         <td class="reqCellAnswer" id="oracleEmployeeNumber"><input id="oracleEmployeeNumberText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
         <td class="noborder" id="oracleEmployeeNumber">&nbsp;</td> 
        </tr> 
        <tr> 
         <td class="reqCellLabel">Last name:</td> 
         <td class="reqCellAnswer" id="lastName"><input id="lastNameText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
         <td class="noborder" id="lastName">&nbsp;</td> 
        </tr> 

        <tr> 
         <td class="reqCellLabel">First name:</td> 
         <td class="reqCellAnswer" id="firstName"><input id="firstNameText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
         <td class="noborder" id="firstName">&nbsp;</td> 
        </tr> 

        <tr> 
         <td class="reqCellLabel">Timezone:</td> 
         <td class="reqCellAnswer" id="timeZone"><input id="timeZoneText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
         <td class="noborder" id="timeZone">&nbsp;</td> 
        </tr> 

        <tr> 
         <td class="reqCellLabel">Default Printer:</td> 
         <td class="reqCellAnswer" id="defaultPrinter"><input id="defaultPrinterText" class="reqCellAnswer" 
          type="text" name="Requestor" value=""></input></td> 
         <td class="noborder" id="defaultPrinter">&nbsp;</td> 
        </tr> 
        <tr> 
         <td class="reqCellLabel">Employee is a buyer ?</td> 
         <td class="reqCellAnswer" id="employeeIsBuyer"><input id="employeeIsBuyerText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
         <td class="noborder" id="employeeIsBuyer">&nbsp;</td> 
        </tr> 
        <tr> 
         <td class="reqCellLabel">Same rights as :</td> 
         <td class="reqCellAnswer" id="sameRightsAs"><input id="employeeIsBuyerText" class="reqCellAnswer" 
          type="text" name="Requestor" ></input></td> 
         <td class="noborder" id="sameRightsAs"><img src="refresh.jpg" alt="" width="16" height="16" /></td> 

        </tr> 
       </table> 
+0

好吧,我會理解你的代碼並回答你是否工作(或不)。 這不是一個例子,但我不使用的名稱,只有與「document.getElementById(...)」 ID非常感謝你的答案的方式 – Riri 2013-02-22 16:34:43

+0

當你提交表單的名稱參數是一個你會在下一步收集中找到的 – Ast 2013-02-22 16:40:35

+0

即使你使用AJAX – Riri 2013-02-22 16:46:21