1

我试着在我的网站上做一张桌子。表格内容具有我在下一个操作中用于参数并自动显示在表单上的值。这是我的场景

表格的内容作为我的弹出窗口的按钮,如下所示

  <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 列。例如:当用户单击 A1.4 时,在“posisi”列中自动具有值 A1.4 并显示

然后当用户单击查看按钮时,“web”将用户引导到一个新页面,该页面显示数据库,其中表内容作为参数。可能是这个http://jsfiddle.net/andricoga/k4BB3/#base可以帮助理解我的问题

我的英语还很弱,我希望你明白我的意思并为我解决问题

4

1 回答 1

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>

你可以在这里http://jsfiddle.net/JLExZ/

于 2013-04-12T09:48:05.487 回答