1 | <form name= "xingao" ><table> <tr> <td> <input id= "" name= "q1" type= "text" value= "" /> <input id= "wupin_id" type= "text" value= "1" /> <!--可用于判断不同的id以添加数据--></td> <td> <a href= " javascript:void(0)" onClick= "window.open('2.php?lx=1');" >导入</a> </td> </tr> <tr> <td> <input id= "" name= "q1" type= "text" value= "" /> <input id= "wupin_id" type= "text" value= "1" /> <!--可用于判断不同的id以添加数据--></td> <td> <a href= " javascript:void(0)" onClick= "window.open('2.php?lx=2');" >导入</a> </td> </tr> </table></form>
|
登入後複製
2.php内容:
<script> <br />opener.document.xingao.tr[0].q1.value="显示内容"; <br />window.close(); <br /></script>
要求结果:改变第一行的
的值
怎么写?
回复讨论(解决方案)
opener.document.xingao.q1[ $n].value="显示内容";
$n 根据需要赋值,因为你的 q1 有多个,所以要按数组操作
1 | <script src= "/js/jquery-1.8.3.js" ></script><script type= "text/javascript" > function import_goods(node){ var tr_number=jQuery( "table" ).index(jQuery(node).parent().parent());
|
登入後複製
感谢,可以用,还有个问题 tr_number 怎么获取得到行数,每次都是-1
tr_number = $(node).parents('tr').prevAll().length+1