我现在有A,B 窗口A窗口的是个表格,表格如下
序号 零件号
1 A0001
2 A0002
3 A0003我现在单击 A0002 这行,通过window.open 弹出子页面B窗口,B窗口把该零件的所有零件显示出来,因为该零件还有其他的规格。我从B窗口中双击选中一个需要的零件,如何做到A窗体的值相应的修改.我知道可以用opener 但是具体如何操作就。求
序号 零件号
1 A0001
2 A0002
3 A0003我现在单击 A0002 这行,通过window.open 弹出子页面B窗口,B窗口把该零件的所有零件显示出来,因为该零件还有其他的规格。我从B窗口中双击选中一个需要的零件,如何做到A窗体的值相应的修改.我知道可以用opener 但是具体如何操作就。求
window.openner.$("#id").value = "you value";
用window.openner.方法名,可以调用父窗口的方法
$("#tableNeed tr").dblclick(function(){
//获取零件原因,并给出事件
if ($(this).children(".res").text()=="该记录不止一条,需选择"){
OpenPage($(this).children(".Ljid").text(),$(this).children(".Ljid"));
}else if($(this).children(".res").text()=="找不到该零件"){
alert("找不到该零件");
}
});其中OpenPage($(this).children(".Ljid").text())这里面是A 页面传递的参数。
//获取零件原因,并给出事件
if ($(this).children(".res").text()=="该记录不止一条,需选择"){
OpenPage($(this).children(".Ljid").text());
}else if($(this).children(".res").text()=="找不到该零件"){
alert("找不到该零件");
}
});
function OpenPage(LjID) {
url="JQWindows.asp?huohao="+LjID;
window.open (url,'newwindow','height=400,width=800,top=150,left=300,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1" id="tableNeed">
<tr align="center">
<td Align="center"class="category" height="30">选中</td>
<td class="category" width="30">序号</td>
<td class="category" height="30">零件号</td>
<td class="category">数量</td>
<td class="category">说明</td>
<td class="category">删除</td>
</tr>
<%if session("fail")="" then%>
<tr align="center" onMouseOver="this.className='highlight'" onMouseOut="this.className=''">
<td colspan="12" height="25" align="center" style="color:red"><b>没有找到记录</b></td>
</tr>
<%else%>
<%=TrContent%>
<tr align="center" onMouseOver="this.className='highlight'" onMouseOut="this.className=''">
<td colspan="12" height="25" align="right" style="color:red">
[ <%=ShowNowPage%> / <%=ShowPageCount%> ] 共 <%=UBoundArr%> 条记录
<a href="ShowInfo.asp?Action=ShouYe">首页</a>
<a href="ShowInfo.asp?Action=ShangYe">上一页</a>
<a href="ShowInfo.asp?Action=XiaYe">下一页</a>
<a href="ShowInfo.asp?Action=MoYe">末页</a>
</td>
</tr>
<%end if%>
<tr>
<td colspan="12" height="30" class="category">
<div style="float:left" ><input name="chkall" type="checkbox"> 全选</div>
<div align="center"><button id="test4">更新开始</button></div>
</td>
</tr>
</table><script type="text/javascript">
$(document).ready(function() {
$("#tableNeedFrame tr").dblclick(function(){
//获取零件原因,并给出事件
Ljh=$(this).children(".ljid").text();
obj=$(this).children(".obj");
alert(obj);
$.ajax({
url:'SaveSucceed.asp', //(默认: 当前页地址) 发送请求的地址。
data:{Ljh:Ljh},
success:function(data){
alert(window.openner.$("#tableNeed tr").$(this).children(".res").text());
}
});
});
});
</script>
这样,在function中就能知道是选择的什么了此时tr的dblclick事件可以用each遍历添加
$(document).ready(function() {
$("#tableNeedFrame tr").dblclick(function(){
//获取零件原因,并给出事件
Ljh=$(this).children(".ljid").text();
obj=$(this).children(".obj");
alert(obj);
$.ajax({
url:'SaveSucceed.asp', //(默认: 当前页地址) 发送请求的地址。
data:{Ljh:Ljh},
success:function(data){
alert(window.openner.$("#tableNeed tr").$(this).children(".res").text());//--->注意这里的$(this)不是你要的当前被双击的tr,你可以在ajax方法前面定义一个变量保存tr,在这里使用
}
});
});
});
获取的好像全部是OBJECT .你加下我QQ .6066476 .