php - 如何从表格内容中获取记录作为弹出表单的数据并显示

标签 php javascript html

我作为弹出按钮制作的表格内容。 该弹出窗口具有输入表单和链接到另一个页面的功能 这是我的表格的示例

 <div>
  <table width="1023" height="248" border="1">
    <td><div align="center"><input type="button" onclick="popup_window_show('#sample', { pos : 'tag-right-down',   parent : this, width : '270px' });" value="A1.8" /></td>
  </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" value="" /></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>

也许这个屏幕截图可以帮助您理解我的问题

https://www.dropbox.com/s/bwil302fdzhe0f5/New%20Picture%20%2829%29.bmp

我的问题

如何获取按钮值作为弹出表单的数据并自动显示在表单“posisi”中?

最佳答案

这就是瑞奇的答案

<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/

关于php - 如何从表格内容中获取记录作为弹出表单的数据并显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15738827/

相关文章:

html - 表行中带有 "nowrap"的元素会阻止整行在 IE8 中换行

javascript - 在不同页面中加载 javascript 的最佳(快速)方法是什么?

html - 适用于 Cordova 的 Google AdMob 插件,当我们单击“添加”并按“后退”按钮返回应用程序时,应用程序正在关闭

javascript - 替换两侧都有空格的所有出现的字符串

javascript - 使用ajax javascript将内容加载到网页中的div中

javascript - ngOnInit 内的引用错误

php - ssh2_scp_send() 和 ssh2_scp_recv() 函数在 php 中不起作用。为什么?

php - 无法加载 URL : The domain of this URL isn't included in the app's domains. 要能够加载此 URL... Codeigniter

javascript - 如何在具有多行且动态构建的数据表中提交表单?

php - 我在哪里放置 View 助手所需的 View 脚本(使用 Zend_View 和默认目录布局)?