2013-03-30 13 views
1

我試着在我的網頁中製作一個表格。表格內容具有我在下一個操作中用於參數並自動顯示在表單上的值。 這裏我skenario如何讓表格內容自動顯示在彈出窗體中

的表作爲按鈕的內容爲我彈出這樣

<div> 
    <table width="1023" height="248" border="1"> 
     <tr> 
     <th colspan="2" scope="col">A1</th> 
     <th colspan="2" scope="col">A2</th> 
     <th colspan="2" scope="col">A3</th> 
     </tr> 
     <tr> 
     <td><div align="center"><input type="button" onclick="popup_window_show('#sample', { pos : 'tag-right-down', parent : this, width : '270px' });" value="A1.4" /></td> 
     <td><div align="center"><input type="button" onclick="popup_window_show('#sample', { pos : 'tag-right-down', parent : this, width : '270px' });" value="A1.8" /></td> 
     <td><div align="center"><input type="button" onclick="popup_window_show('#sample', { pos : 'tag-right-down', parent : this, width : '270px' });" value="A2.4" /></td> 
     <td><div align="center"><input type="button" onclick="popup_window_show('#sample', { pos : 'tag-right-down', parent : this, width : '270px' });" value="A2.8" /></td> 
     <td><div align="center"><input type="button" onclick="popup_window_show('#sample', { pos : 'tag-right-down', parent : this, width : '270px' });" value="A3.4" /></td> 
     <td><div align="center"><input type="button" onclick="popup_window_show('#sample', { pos : 'tag-right-down', parent : this, width : '270px' });" value="A3.8" /></td> 
    </tr> 
</div> 

這個我popup_window_show

<div class="popup_window_css" id="sample"> 
    <div class="popup_window_css_head"><img src="images/close.gif" alt="" width="9" height="9" />Aksi</div> 
    <div class="popup_window_css_body"><div style="border: 1px solid #808080; padding: 6px; background: #FFFFFF;"> 
    <form method="post" action=""> 
    <table width="200"> 
     <tr> 
     <td colspan='2' align='center'> WHK </td> 
     <tr> 
     <td> Posisi :</td> 
     <td> <input type='text' name="p" /></td> 
     </tr> 
     <tr> 
     <td> Product ID :</td> 
     <td> <input type='text' name="id" /></td> 
     </tr> 
     <tr> 
     <td> Product Name :</td> 
     <td> <input type='text' name="nama" /></td> 
     </tr> 
     <tr> 
     <td> Production Date :</td> 
     <td> <input type='text' name="tgl" /></td> 
     </tr> 
     <tr> 
      <td colspan='2' align='right'> 
      <input type='submit' value= 'Save'> 
      <input type='reset' value='Reset' /> 
      <input type='button' value='view' onclick=\"window.location.href='#';\"/> 
      </td> 
     </tr> 
    </table> 
    </div> 
</div> 

我的重點問題,如何使表的內容將顯示全自動的在Posisi coloumn彈出窗體。 例如:當用戶clik A1.4如此在「posisi」coloumn中自動獲得值A1.4並顯示

然後當用戶點擊查看按鈕時,「web」引導用戶到一個顯示數據庫的新頁面表格內容作爲參數。 可能是這個http://jsfiddle.net/andricoga/k4BB3/#base可以幫助理解我的問題

我的英語仍然薄弱,我希望你明白我的意思,並給予解決我TQ

回答

1

是的,我發現

<script> 
     function setvalue(values) { 
     document.getElementById('posisi').value = values; 
    } 
    </script> 
    <div> 
     <table width="1023" height="248" border="1"> 
      <tr> 
       <td> 

         <input type="button" onclick="setvalue(this.value);" value="A1.8" /> 
       </td> 
      </tr> 
     </table> 
     </div> 
     <div class="popup_window_css" id="sample"> 
      <table class="popup_window_css"> 
       <tr class="popup_window_css"> 
        <td class="popup_window_css"> 
         <div class="popup_window_css_head"> 
          <img src="images/close.gif" alt="" width="9" height="9" />Aksi</div> 
         <div class="popup_window_css_body"> 
          <div style="border: 1px solid #808080; padding: 6px; background: #FFFFFF;"> 
           <form method="post" action=""> 
            <table> 
             <tr> 
              <td>Werehouse</td> 
              <tr> 
               <td>Posisi</td> 
               <td> 
                <input type='text' name="p" id="posisi" /> 
               </td> 
              </tr> 
              <tr> 
               <td>Product ID</td> 
               <td> 
                <input type='text' name="id" /> 
               </td> 
              </tr> 
              <tr> 
               <td>Product Name</td> 
               <td> 
                <input type='text' name="nama" /> 
               </td> 
              </tr> 
              <tr> 
               <td>Production Date</td> 
               <td> 
                <input type='text' name="tgl" /> 
               </td> 
              </tr> 
              <tr> 
               <td colspan='2' align='right'> 
                <input type='submit' value='Save'> 
                <input type='reset' value='Reset' /> 
                <input type='button' value='view' onclick=\ "window.location.href='#';\"/> 
               </td> 
              </tr> 
            </table> 
          </div> 
         </div> 

可以cek here http://jsfiddle.net/JLExZ/

+0

haha​​hahah ....你發現最後 – newbie

相關問題