hello, I create a dhtmlxwindow with clicking a button in main window, the created window attaches to an url page of the same domain,when after operating in window, I want the main window’s vertical scrollbar scrolls to bottom, here are part of the code:
parent.window.scrollToBottom();
//alert("close");// here ,pay attention~
parent.closeExistSchema();
//===================
function closeExistSchema(){
dhxWins.window("existSchema").close();
}
function scrollToBottom(){
window.scrollTo(0,document.body.scrollHeight);
}
the only problem is that the vertical scrollbar doesn’t scroll to the bottom, if I uncomment this sentence: alert(“close”), the main window scroll bar does scroll to the bottom, then click “ok” of alert window, then the scroll bar goes up to its original place, so why? why the bar goes back?
regards,
after close the window,the parent.window is not the main window but the created one,so there is no scrollToBottom() in created window, why “parent.window.location.href” are not same in two times?
hi, I write a demo,there are two pages:test1.jsp and test2.jsp,and click a button in test2.jsp to open test1.jsp in a dhtmlXwindow, then click a button in test1.jsp to close the dhtmlXwindow and then make scrollbar in test2.jsp to scroll to the bottom. here are my code:
test1.jsp:
<script type="text/javascript">
function closeSelf(){
//solution1 =====
/*
alert(parent.window.location.href);//test2.jsp,
parent.closeMe();
alert(parent.window.location.href);//test1.jsp,
parent.scrollToBottom();//no scrollToBottom() in test1.jsp
*/
//solution2 =======
window.setTimeout(function(){
alert(parent.window.location.href);//test1.jsp
parent.window.scrollToBottom();//no scrollToBottom() in test1.jsp
},1);
parent.closeMe();
}
</script>
<body>
Hello, this is my included test1.jsp page
<br/>
<input type="button" value="closeMe" onclick="closeSelf()"/>
</body>
test2.jsp:
<script type="text/javascript" src="../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../js/dhtmlxwindow/dhtmlxcommon.js"></script>
<script type="text/javascript" src="../js/dhtmlxwindow/dhtmlxcontainer.js"></script>
<script type="text/javascript" src="../js/dhtmlxwindow/dhtmlxwindows.js"></script>
<link rel="stylesheet" type="text/css" href="../css/dhtmlxwindow/dhtmlxwindows.css"/>
<link rel="stylesheet" type="text/css" href="../css/dhtmlxwindow/skins/dhtmlxwindows_dhx_skyblue.css"/>
<script type="text/javascript" src="test.js"></script>
<input type="button" value="openMe" onclick="openMe()"/>
<br/><br/>
This page is the main page<br/>
fill in content to make vertical scrollBar appear<br/>
fill in content to make vertical scrollBar appear<br/>
......
test.js:
var dhxWins = null;
function openMe(){
dhxWins = new dhtmlXWindows();
dhxWins.enableAutoViewport(true);
dhxWins.setImagePath("../css/dhtmlxwindow/imgs/");
var me = dhxWins.createWindow("me",0,0,500,400);
me.setText("Test");
me.attachURL("test1.jsp");
me.button("minmax1").disable();
//me.centerOnScreen();
}
function closeMe(){
dhxWins.window("me").close();
}
function scrollToBottom(){
window.scrollTo(0,document.body.scrollHeight);
}
in closeSelf() of test1.jsp, the two solutions don’t work well neither, so what can to be done to my question ?
regards,