jquery dialog 的使用不解,每次窗体滚动条回到顶部,求解

tanguang_honesty 2012-10-23 10:24:45
由于本人积分不多了,有问题请各位大侠帮助。如有不明白的地方,请说。
第一个页面是父窗体页面
<%@page contentType='text/html;charset=UTF-8'%>
<%@page errorPage="/egp/error.jsp"%>
<%@page import="java.util.*"%>
<%@page import="com.cntaiping.egp.util.web.*"%>
<%@page import="com.cntaiping.egp.util.common.Tools"%>
<%@ page import="com.cntaiping.egp.util.db.ListPage"%>
<%@ page import="com.cntaiping.egp.system.login.EGPUser"%>
<%
String ctxPath = request.getContextPath();
DynaForm form = (DynaForm) request.getAttribute("dynaForm");
Map resultMap = (Map) request.getAttribute("resultMap");
if (resultMap == null) {
resultMap = new HashMap();
}
EGPUser user = (EGPUser) session.getAttribute("EGP_USER");
%>
<link type="text/css" href="<%=ctxPath%>/egp/js/jquery/jquery-ui.css" rel="stylesheet" />
<link type="text/css" href="<%=ctxPath%>/egp/js/jquery/plugins/borderlayout/jquery.layout.css" rel="stylesheet"/>
<script type="text/javascript" src="<%=ctxPath%>/egp/js/jquery/jquery.js"></script>
<script type="text/javascript" src="<%=ctxPath%>/egp/js/jquery/plugins/bgiframe/jquery.bgiframe.js"></script>
<script type="text/javascript" src="<%=ctxPath%>/egp/js/jquery/jquery-ui.js"></script>
<script type="text/javascript" src="<%=ctxPath%>/egp/js/jquery/plugins/borderlayout/jquery.layout.js"></script>
<script type="text/javascript">

var myLayout; // a var is required because this page utilizes: myLayout.allowOverflow() method
$(document).ready(function () {
// Dialog
myDialog = $('#dialog').dialog({
autoOpen: false,
width: 750,
height:380,
draggable: true,
bgiframe: true,//dialog的select bug 被隐藏
resizable: true,
resizable: false, //dialog的大小不可以改变
draggable:false, //dialog不可以拖动
modal:true,
title:"",
close: function(event, ui) {
document.getElementById("dlgFrame").src="about:blank";
}
});
});
function openDialog(title,src,width,height,position){
myDialog.dialog('option','title',title);

document.getElementById("dlgFrame").src=src;

//if (!width) width=900;
//myDialog.dialog('option','width',width);

//if (!height) height=500;
//myDialog.dialog('option','height',height);

//if (!position) position="center";
//myDialog.dialog('option','position',"center");
myDialog.dialog({ position: ['center','middle'] });
myDialog.dialog('option','modal',true);
// alert(document.body.scrollHeight);
// document.body.scrollTop=250;
myDialog.dialog('open');
// alert(document.body.scrollHeight);
//document.body.scrollTop=250;
}

</script>
<script type="text/javascript">


function openPRO(pol_no,insu_seq,customerid){//add tanguang 20120905 costomerId
//document.getElementById("dlgFrame").src=
//openDialog('险种信息',"<%=ctxPath%>/servlet/com.cntaiping.egp.clerk.InsuredServlet?sAction=exportProDetail&pol_no="+pol_no+"&customerid="+customerid+"&insu_seq="+insu_seq);
document.getElementById("dlgFrame").src="<%=ctxPath%>/egp/cleck/file_upload.jsp";
myDialog.dialog('option','title','资质材料影像上载');
alert("scrollHeight"+document.body.scrollHeight);
myDialog.dialog('open');
//alert("scrollHeight"+document.body.scrollHeight);
document.body.scrollTo(document.body.scrollHeight);
///alert(document.body.scrollWidth );

}
</script>

<div class="right" style="width:765px;margin-top:-20px;" id="right">

<form action="<%=form.getActionURI()%>" method="post">

<input type='button' onclick='onclick="openPRO(1,2,3)">
<div class="hide" id="dialog" title="Dialog Title" >
<iframe
id="dlgFrame" name="dlgFrame" class="ui-layout-center" width="900px"
height="520" frameborder="0" scrolling="auto" style="margin-left:18px;"></iframe>
</div>
</form>
</div>
</div>
</div>


请问为什么每次点击完查询列表的数据后,弹出的iframe 框架自动把滚动条寄到最上面去了,求解

效果如图,就是纵向滚动条始终回到顶部了,导致弹出框不能在垂直的正中央,谢谢!



...全文
766 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wu_now 2012-11-10
  • 打赏
  • 举报
回复
真是牛人了,这么一大段代码,就用一句终结啦,佩服的五体投地呀!!
tanguang_honesty 2012-11-09
  • 打赏
  • 举报
回复
哎,牛人啊,一下就解决了。。。
simplexc 2012-11-09
  • 打赏
  • 举报
回复 1
onclick='onclick="openPRO(1,2,3);return false;"> 就行了, up 接分!!!
tanguang_honesty 2012-10-23
  • 打赏
  • 举报
回复
补充一下iframe 子窗体信息页面内容
<%@page contentType='text/html;charset=UTF-8'%>
<%@page errorPage="/egp/error.jsp"%>
<%@page import="java.util.*"%>
<%@page import="com.cntaiping.egp.util.web.*"%>
<%@page import="com.cntaiping.egp.util.common.Tools"%>
<%@ page import="com.cntaiping.egp.util.db.ListPage"%>
<%@ page import="com.cntaiping.egp.system.login.EGPUser"%>
<%
String ctxPath = request.getContextPath();
DynaForm form = (DynaForm) request.getAttribute("dynaForm");
Map resultMap = (Map) request.getAttribute("resultMap");
if (resultMap == null) {
resultMap = new HashMap();
}
EGPUser user = (EGPUser) session.getAttribute("EGP_USER");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

</head>
<body>
<form name="form1" method="post" ENCTYPE="multipart/form-data" target="hidden_frame" >
<input type="hidden" id="agentIdInfo" name="agentIdInfo"/>
<input type="hidden" id="chval" name="chval"/>
<input type="hidden" id="applyId" name="applyId"/>
<table id="typeInfoTbl" name="typeInfoTbl" class="singleTbl" cellspacing="1">
<tr class="even">
<th>文件路径</th>
<td>

<input class="text" type="file" name="inputfile" id="inputfile" size="50" contentEditable="false">
<input id="oupter" type="button" name='uploadFile1' class="button" value=" 上载 " onClick="uploadFile();">
</td>
</tr>

</table>
<table class="listTbl" cellspacing="1" id="selectAvgTbl" name="selectAvgTbl">
<caption>已上载资质材料列表</caption>
<tr>
<th scope="col" nowrap>选择</th>
<th scope="col" nowrap>文件名</th>
<th scope="col" nowrap>上传人</th>
<th scope="col" nowrap>上传时间</th>
</tr>
<tbody id="tbrTbody">
</tbody>
</table>
<div style="color:red;text-align:center;" id="comValidateError"></div>
<table>
<tr>
<td align="center">
<input type="button" name='downLoadFile1' class="button" value=" 下载 " onclick="downLoadFile()" />
<input type="button" name='deleteFile1' class="button" value=" 删除 " onclick="deleteFile()" />
<input type="button" class="button" value=" 退出 " onclick="closeParentWindow()"/>
</td>
</tr>
</table>
<iframe name='hidden_frame' id="hidden_frame" style="display:none;"></iframe>
</form>

</body>
</html>

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧