function showANewWindow(url,title){
topWin= new top.Ext.Window({
id:'topWindow',
title:title,
width:650,
height: 450,
resizable:true,
constrain :true,
plain :true,
autoScroll :true,
maximizable :true,
modal: true,
html:'<iframe id="newWindowFrame" src="'+url+'" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>'
});topWin.show();
}
弹出一个窗口!
然后在这个窗口里面载入一个jsp页面,在这个jsp页面里面有一个
Ext.onReady(function(){
var i = document.getElementById("i");
alert(i.value);
window.moveTo(1500, 1500);
window.parent.document.getElementById("");
});
这样的代码,页面载入时就自动触发,然后拿到i后,想做一个判断,如果符合判断的话,就弹出一个alert("warning");然后把上面弹出来的窗口给关闭掉,我可以肯定i是可以拿到的,但无论我用window.close();还是window.parent.document.getElementById("");窗口ID我没有找到!
我想问下,该如何才可以把我这个弹出来的窗口关闭掉呢?
5 个解决方案
#1
没人?
#2
var topWin;//////
function showANewWindow(url,title){
topWin= new top.Ext.Window({
id:'topWindow',
title:title,
width:650,
height: 450,
resizable:true,
constrain :true,
plain :true,
autoScroll :true,
maximizable :true,
modal: true,
html:'<iframe id="newWindowFrame" src="'+url+'" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>'
});topWin.show();
}
Ext.onReady(function(){
var i = document.getElementById("i");
alert(i.value);
window.moveTo(1500, 1500);
window.parent.document.getElementById("");
parent.topWin.close();////////
});
#3
既然页面在ext的window中,直接关闭ext的窗体不就ok了
试试
function showANewWindow(url,title){
topWin= new top.Ext.Window({
id:'topWindow',
title:title,
width:650,
height: 450,
resizable:true,
constrain :true,
plain :true,
autoScroll :true,
maximizable :true,
modal: true,
html:'<iframe id="newWindowFrame" src="'+url+'" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>'
});topWin.show();
window.topWnd=topWin;
}
子页面:
Ext.onReady(function(){
var i = document.getElementById("i");
alert(i.value);
window.parent.window.topWnd.close();
});
试试
function showANewWindow(url,title){
topWin= new top.Ext.Window({
id:'topWindow',
title:title,
width:650,
height: 450,
resizable:true,
constrain :true,
plain :true,
autoScroll :true,
maximizable :true,
modal: true,
html:'<iframe id="newWindowFrame" src="'+url+'" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>'
});topWin.show();
window.topWnd=topWin;
}
子页面:
Ext.onReady(function(){
var i = document.getElementById("i");
alert(i.value);
window.parent.window.topWnd.close();
});
#4
因为你topWin是定义的局部变量,你可以这样,在你的jsp页面里编写
Ext.onReady(function(){
var i = document.getElementById("i");
alert(i.value);
window.moveTo(1500, 1500);
window.parent.document.getElementById("");
//parent.topWin.close();////////
////////////////////////////////////////////////条件成立时,你执行下面的关闭窗体
var _topWindow = window.parent.Ext.getCmp("topWindow");
if (_topWindow) {
topWindow.close();
}
});
#5
你好,请问你学的是什么专业啊?哪方面的?
#1
没人?
#2
var topWin;//////
function showANewWindow(url,title){
topWin= new top.Ext.Window({
id:'topWindow',
title:title,
width:650,
height: 450,
resizable:true,
constrain :true,
plain :true,
autoScroll :true,
maximizable :true,
modal: true,
html:'<iframe id="newWindowFrame" src="'+url+'" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>'
});topWin.show();
}
Ext.onReady(function(){
var i = document.getElementById("i");
alert(i.value);
window.moveTo(1500, 1500);
window.parent.document.getElementById("");
parent.topWin.close();////////
});
#3
既然页面在ext的window中,直接关闭ext的窗体不就ok了
试试
function showANewWindow(url,title){
topWin= new top.Ext.Window({
id:'topWindow',
title:title,
width:650,
height: 450,
resizable:true,
constrain :true,
plain :true,
autoScroll :true,
maximizable :true,
modal: true,
html:'<iframe id="newWindowFrame" src="'+url+'" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>'
});topWin.show();
window.topWnd=topWin;
}
子页面:
Ext.onReady(function(){
var i = document.getElementById("i");
alert(i.value);
window.parent.window.topWnd.close();
});
试试
function showANewWindow(url,title){
topWin= new top.Ext.Window({
id:'topWindow',
title:title,
width:650,
height: 450,
resizable:true,
constrain :true,
plain :true,
autoScroll :true,
maximizable :true,
modal: true,
html:'<iframe id="newWindowFrame" src="'+url+'" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>'
});topWin.show();
window.topWnd=topWin;
}
子页面:
Ext.onReady(function(){
var i = document.getElementById("i");
alert(i.value);
window.parent.window.topWnd.close();
});
#4
因为你topWin是定义的局部变量,你可以这样,在你的jsp页面里编写
Ext.onReady(function(){
var i = document.getElementById("i");
alert(i.value);
window.moveTo(1500, 1500);
window.parent.document.getElementById("");
//parent.topWin.close();////////
////////////////////////////////////////////////条件成立时,你执行下面的关闭窗体
var _topWindow = window.parent.Ext.getCmp("topWindow");
if (_topWindow) {
topWindow.close();
}
});
#5
你好,请问你学的是什么专业啊?哪方面的?