jquery dialog 的使用不解,每次窗体滚动条回到顶部,求解
由于本人积分不多了,有问题请各位大侠帮助。如有不明白的地方,请说。
第一个页面是父窗体页面
<%@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 框架自动把滚动条寄到最上面去了,求解
效果如图,就是纵向滚动条始终回到顶部了,导致弹出框不能在垂直的正中央,谢谢!
![]()
第一个页面是父窗体页面
<%@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 框架自动把滚动条寄到最上面去了,求解
效果如图,就是纵向滚动条始终回到顶部了,导致弹出框不能在垂直的正中央,谢谢!
...全文
相关推荐
jquery 插件 弹出层 回到顶部底部
实现这一功能,可以利用jQuery的`$(window).scroll()`事件监听滚动条移动,然后在适当的时候显示或隐藏回到顶部的按钮。
jquery easyui滚动条部分设置介绍
这种方法对于那些需要频繁使用对话框并且页面内容较长的应用尤其有用,它使得用户无需滚动回顶部或寻找被滚动出去的对话框。
jquery ui dialog ie8出现滚动条的解决方法
"jQuery UI Dialog在Internet Explorer 8中出现滚动条的问题及解决方案"在Web开发过程中,尤其是在使用jQuery UI库创建对话框(Dialog)时,可能会遇到
Jquery对话窗体Jquery对话窗体
使用JQuery对话窗体时,需要注意兼容性问题,确保所选的JQuery和JQuery UI版本与项目中的其他库和框架相兼容。
Jquery_ui的dialog使用文档概述
### Jquery UI 的 Dialog 使用详解#### 概述Jquery UI 的 `Dialog` 是一个非常实用且功能丰富的用户界面组件,它可以帮助开发者快速创建一个浮动的窗口,该窗口包括标题和内容两个主要部分


