难题!如何取得调用FRAME参数后用WINDOW.OPEN打开窗口的DOM路径节点啊

时间:2022-09-02 23:56:45
在一个首页网页中,有三个IFRAME,其中right.html传递窗口参数后,WINDOW.OPEN使用传递过来的参数打开的相应的窗口SRC,并限制在TAB页中,进行业务处理。而我想对WINDOW.OPEN打开的网页的如《取消》按钮进行隐藏,而现在的问题是,我无法取得其DOM路径。使用ie webdevelpoper 取得的DOM是错误的。而后又用EXECSCRIP进行如 VAR MYWIN=OPEN()的形式进行,结果取得的MYWIN内容不全,还是无法取得相应元素的DOM节点。后来又用了WEB BROWER控件进行处理,可我还是无法取得相应元素的DOM节点。请问各位高手,我该如何处理,非常谢谢您的回复。

6 个解决方案

#1


帖网页地址让大家测试呀。

#2


不好意思,是内网应用程序啊。

#3


你至少应该贴出测试代码
不然怎么知道你错在哪里

#4


index.html内容:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!-- :CONSOLE: DON'T MODIFY THIS LINE -->

<HTML>

<HEAD>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

<META HTTP-EQUIV="author" CONTENT="zhanggx">

<TITLE>系统控制台</TITLE>

<link rel="Shortcut Icon" href="../images/logo.ico">

<link rel="Bookmark" href="../images/logo.ico">

<link rel="stylesheet" href="../public/css/ctais.css" type="text/css">

<SCRIPT LANGUAGE="JavaScript" src="./public/js/workservice.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript">

<!--



var PAGE_FLAG = true;



…………………


function window.onload(){

setSplash("系统初始化完成!",100);

window.status = "系统初始化完成!";

//定时器

//60000×15=900000每15m请求一次,保证session有效

//window.setInterval(keepSession,900000);

}

var http = new ActiveXObject("Msxml2.XMLHTTP.4.0");

var action = "../index.htm";

function keepSession(){

try{

http.Open("POST", action,true);

http.setRequestHeader("Connection","close");

http.onreadystatechange = listener;

http.send();

}catch(e){}

}

function listener(){

try {

if(http.readyState == 4){

http.abort();

CollectGarbage();

}

}catch(e){}

}



function exitPage()

{

if(PAGE_FLAG){

event.returnValue = "您将要退出系统!这样会导致尚未保存的数据丢失!\n您确定要退出系统吗?\n\n[确定] 退出系统,关闭当前页面\n[取消] 保留当前页面"

}

}

//刷新和关闭页面时都会触发

function logout()

{

if(PAGE_FLAG){

//alert("From [console/index.htm] 发送注销请求...");

var rtn=getFile('../entry/loginOut?type=ipc&purpose=LogInService&module=Entry');

try{

//top.location.href = "../login.htm";

window.opener=null;

window.close();

}catch(e){}

}

}


function hidePopupWin(){

if (oPopup != null && oPopup.isOpen){

oPopup.hide();

}

}

function setSplash(str,perc){

oPopup.document.all("CONTENT").innerText = str;

setPerc(perc);

}




<FRAMESET id="FRM_WHOLE" ROWS="65,*" frameborder=no border="0" framespacing="0">

<FRAME id="FRM_TOP" SRC="top.jsp" scrolling="NO" marginheight='0' marginwidth='0' noresize>

<FRAMESET id="FRM_MIDDLE" COLS="1,*" framespacing="4" frameborder=1 MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" 

TOPMARGIN="0">

<FRAME id="FRM_LEFT" name="FRM_LEFT" SRC="left.htm" scrolling="NO" marginheight='0' border=0 frameBorder=0 marginwidth='0' borderColor=#184184>

<FRAME id="FRM_RIGHT" name="FRM_RIGHT" SRC="right.htm" scrolling="NO" frameBorder=0 marginheight='0' marginwidth='0' >         

</FRAMESET>

</FRAMESET>

<noframes>系统提示:对不起,您的浏览器不支持框架!</noframes>

</HEAD>

</HTML>






left.html内容


<html xmlns:ctais>

<!-- Don't modify the document!!! -->

<head>

<title>控制台权限管理</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

<META HTTP-EQUIV="author" CONTENT="zhanggx">

<link rel="stylesheet" href="../public/css/ctais.css" type="text/css">

<SCRIPT LANGUAGE="JavaScript" src="./public/js/workservice.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" src="../work/public/js/service.js"></SCRIPT>

<SCRIPT >

<!--

/**

 * 屏蔽右键菜单

 */

function window.document.oncontextmenu(){

return false;

}

//以下函数供小应用程序AppletRole调用

//需要将bl:str->boolean

function navigate(s1,s2,bl)

{

var b = false;

if (bl != null && bl == "true"){

b = true;

}

top.FRM_RIGHT.navigate(s1,s2,b);

}

function setActive(bl,str)

{

top.FRM_RIGHT.setActive(bl,str);

}



function treeNodeClick()

{

var treeNode = tree1.getSelectedNode();

if(treeNode.extraData == "role" && treeNode.childCount == 0)

{

// var roleId = tree1.getSelectedNode().key;

// var parNode = tree1.getSelectedNode();

//

// var root = top.FRM_RIGHT.getRoleTree(roleId).childNodes.item(0);

//

// if(root != null)

// {

// for(i = 100;i < root.childNodes.length + 100;i++)

// {

// addTreeNode(root.childNodes.item(i - 100),parNode,roleId,i);

// }

// tree1.collapseNode(parNode);

// }

// tree1.collapseAll();



var rolesDom = loadXml(tree1.rootNode.xml);

var roleId = tree1.getSelectedNode().key;

var nodeIndex = 0;

for(var i = 0;i < rolesDom.childNodes.item(0).childNodes.length;i ++)

{

if(rolesDom.childNodes.item(0).childNodes.item(i).getAttribute("KEY") == tree1.getSelectedNode().key) nodeIndex = i;

}

//changeTreeImg(rolesDom.childNodes.item(0),0);

var rolesroot = rolesDom.childNodes.item(0).childNodes.item(nodeIndex);

var doc = getRoleTree(roleId);

if(doc != null){

var oneNode = doc.childNodes.item(0);

oneNode.setAttribute("KEY", rolesroot.getAttribute("KEY"));

oneNode.setAttribute("NAME", rolesroot.getAttribute("NAME"));

rolesDom.childNodes.item(0).replaceChild(oneNode,rolesroot);

oneNode.setAttribute("EXTRADATA", "role");

tree1.removeAll();

tree1.loadXML(rolesDom);

}

}



else if(tree1.getSelectedNode().extraData != "session" && tree1.getSelectedNode().extraData != "role")

{

var tarStr = tree1.getSelectedNode().key.substring(6,tree1.getSelectedNode().key.length);

tarStr = tarStr.replace(/\$\*\$/g,'&');

//tarStr = tarStr.replace('$*$','&');

var navUrl = '/ctais/console/../entry/EntryServlet?type=ipc&purpose=EntryService&module=Entry&target=';

navUrl = navUrl + tarStr + '&GZBZ=N&ctais_gw=' + tree1.getSelectedNode().extraData;

navigate(navUrl,treeNode.text,false);

}



}

var SESSION_ID = createWorkId();

function getRoleTree(roleId)

{

var svc = new Service("PortalService.getNewView",SESSION_ID);

var oRtn = svc.doService("roleId",roleId);

//alert(oArg);

var oDoc;

if (svc.getRtnCode()=="0")

  { 

  if (svc.getCode()=="2000")

{

oDoc = loadXml(oRtn);

return oDoc;

    } else {

alert("请求权限数据出错:\n"+svc.getMessage(),2);

      return null;

}

} else {

      alert("请求权限数据出错:\n"+svc.getMessage(),3);

      return null;

}

}





<?IMPORT namespace=ctais implementation="../work/public/htc/xtree.htc"> 



</head>



<body bgcolor="#1B4283"  leftmargin="0" topmargin="0" style="margin-top:0;margin-left:0;" onload="init();">

<TABLE border="0" style="border-left:solid 5 #1B4283" width="100%" height="100%" cellpadding="0" cellspacing="0" bgcolor="#B9EAEF">

<TR style="height:21">

<TD align="left" style="width:2" background=""></TD>

<TD><img src="./images/left-ding.gif"></TD>

<TD align="right" valign=top background="images/left-bianbg.gif"><img src="images/left-dingjiao.gif" >



</TD>

</TR>

<TR  height="100%" width="100%">

<TD height="100%" colspan=2>

<ctais:tree style='width:100%;height:100%' id=tree1 onnodeclick2="treeNodeClick();"/>

</TD>

<TD style="width:4" background="images/left-bianbg.gif">

</TD>

</TR>

</TABLE>

</body>

</html>




RIGHT.HTML内容



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!-- :CONSOLE: DON'T MODIFY THIS LINE -->

<HTML>

<HEAD>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

<META HTTP-EQUIV="author" CONTENT="zhanggx">

<TITLE>系统控制台</TITLE>

<link rel="Shortcut Icon" href="../images/logo.ico">

<link rel="Bookmark" href="../images/logo.ico">

<link rel="stylesheet" href="../public/css/ctais.css" type="text/css">

<SCRIPT LANGUAGE="JavaScript" src="./public/js/workservice.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript">

<!--



var PAGE_FLAG = true;



//试运行时增加


//刷新和关闭页面时都会触发


<object id="ActiveX_MSXML3" width=0 height=0 classid="clsid:f5078f19-c551-11d3-89b9-0000f81fe221"

codebase="./public/lib/msxml3.cab">

</object>

<object id="ActiveX_MSXML4" width=0 height=0 classid="clsid:88d969c0-f192-11d4-a65f-0040963251e5"

codebase="./public/lib/msxml4.cab">

</object>



<object id=min classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> 

<param name="Command" value="Minimize"></object> 

<object id=max classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> 

<param name="Command" value="Maximize"></object> 




<FRAMESET id="FRM_WHOLE" ROWS="65,*" frameborder=no border="0" framespacing="0">

<FRAME id="FRM_TOP" SRC="top.jsp" scrolling="NO" marginheight='0' marginwidth='0' noresize>

<FRAMESET id="FRM_MIDDLE" COLS="1,*" framespacing="4" frameborder=1 MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" 

TOPMARGIN="0">

<FRAME id="FRM_LEFT" name="FRM_LEFT" SRC="left.htm" scrolling="NO" marginheight='0' border=0 frameBorder=0 marginwidth='0' borderColor=#184184>

<FRAME id="FRM_RIGHT" name="FRM_RIGHT" SRC="right.htm" scrolling="NO" frameBorder=0 marginheight='0' marginwidth='0' >         

</FRAMESET>

</FRAMESET>

<noframes>系统提示:对不起,您的浏览器不支持框架!</noframes>

</HEAD>

</HTML>



LEFT.html内容是权限树,根据用户点击产生相应JSP的URL,调用RIGHT.HTML中WINDOW.OPEN产生新的窗口,并将窗口内容限制在一个FRAME内。我现的在问题是如何取得WINDOW.OPEN中的元素的DOM,从而对其进行HIDE.服务器是在上面的,我们无法修改其原代码(因字数限制及节约各位高手时间,删除了一些源代码内容)。



#5


内容太多了,下面才 是RIGHT.HTML内容 


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!-- Don't modify the document!!! -->

<HTML xmlns:ctais>

<HEAD>

<META http-equiv="Content-Type" content="text/html; charset=gb2312">


<TITLE>系统工作区</TITLE>

<?IMPORT namespace=ctais implementation="../work/public/htc/xmsg.htc"> 

<link rel="stylesheet" href="../public/css/ctais.css" type="text/css">

<SCRIPT LANGUAGE="JavaScript" src="../work/public/js/service.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" src="./public/js/workservice.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" src="../work/public/js/menu.js"></SCRIPT>



<SCRIPT language=javascript>

window.onresize = flagDir;



var SELECTED_INDEX = -1;



var TAB_LIST = new Array();



function getTabParam(flag,idx){

var aList = TAB_LIST[idx];

if(aList != null){

return aList[flag];

}

return null;

}





/**

 * 点击Tab页时选中它

 */

//已省略很多.......



/** 导航页面

 * @param sUrl 链接地址

 * @param sTitle 链接的标题

 * @param bl 是否在新窗口打开工作区

 */

function navigate(sUrl,sTitle,bl){

if(bl == null || !bl){

if(containsTab(sTitle)){

if(!confirm("工作区["+sTitle+"]已经存在,\n您确定还要打开新的工作区吗?")){

return;

}

}

if(IS_WIN98 && SYS_RES != null){

try{

if(SYS_RES.FreeUserRes < SYS_USER || SYS_RES.FreeGDIRes < SYS_GDI){

alert("警告(仅在WINDOWS98下会发生):\nWINDOWS98系统的剩余资源太少,请先关闭多余的工作区。\n然后再尝试打开新的工作区。");

return;

}



}catch(e){

//alert("check sys res:"+e.message);

}

}

if(getTabCount() < MAX_TAB_COUNT){

showLoading(true);

addTab(sTitle,"./images/state1.gif",sUrl);

}else{

if(IS_WIN98){

alert("系统提示:\n您打开的工作区过多,WINDOWS98的系统资源有限,请关闭多余的工作区");

return;

}else{

alert("系统提示:\n您最多可以打开["+MAX_TAB_COUNT+"]个工作区\n请关闭多余的工作区\n注:超出的工作区将从新窗口打开");

navigate_new(sUrl,sTitle);

}

}

}else{

if(IS_WIN98){

if(SYS_RES != null){

try{

if(SYS_RES.FreeUserRes < SYS_USER || SYS_RES.FreeGDIRes < SYS_GDI){

alert("警告(仅在WINDOWS98下会发生):\nWINDOWS98系统的剩余资源太少,请先关闭多余的工作区。\n然后再尝试打开新的工作区。");

return;

}

}catch(e){

//alert("check sys res:"+e.message);

}

}

if(getTabCount() >= MAX_TAB_COUNT){

alert("系统提示:\n您打开的工作区过多,WINDOWS98的系统资源有限,请关闭多余的工作区");

return;

}

}

navigate_new(sUrl,sTitle);

}

}

/** 导航页面到新窗口

 * @param sUrl 链接地址

 * @param sTitle 链接的标题

 */

function navigate_new(sUrl,sTitle){

var wh = "";

var param = "";

if (sUrl.indexOf("work/yhs/yhs.htm")!=-1){

wh = "width="+(screen.width-10)+",height="+(screen.height-80);

param = "toolbar=no,location=no,status=yes,resizable=yes,scrollbars=yes,top=0,left=0,"+wh;

}

else{

wh = "width="+(screen.width-10)+",height="+(screen.height-60);

param = "toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes,top=0,left=0,"+wh;

}



var win = window.open("/ctais/console/right_new.htm?workurl="+sUrl+"&worktitle="+sTitle,"_blank",param);

if(win != null){win.$auth="$true$"}

}

/**关闭当前工作区

 * @param bl true/false是否强制退出,null==false

 */

 */


//-->

</SCRIPT>


</HEAD>

<BODY style="padding: 46 0 0 0;" scroll=no>

<TABLE onselectstart="return false" background="./images/main_bg.gif" border=0 style="position:absolute;top:0; width:100%;height:48;z-index:0" cellSpacing=0 cellPadding=1>

<TR >

<TD style="padding-left:10"><DIV id="tabContainer" style="position:absolute;top:0; width:100%;height:20;font-size:15;overflow-y:no;overflow-x:hidden;">

<TABLE style="width:30;height:20;" border=0 cellSpacing=2 cellPadding=0>

<TR id=tabList>

</TR>

</TABLE>

</DIV>

</TD>

<TD style="width:55;cursor:hand;" nowrap valign=bottom>


</TD> <TD rowspan=2 style="width:19" background="images/main-jiao.gif" style="padding-left:0;padding-right:0">

<div style="position:absolute; width:19px; height:100%; z-index:10; top: 30; visibility: visible; background-image: url(images/main-rightbg.gif); layer-background-image: url(images/main-rightbg.gif); border: 1px none #000000;"> 

<table style="width:16;height:690" border="0" align="right" cellpadding="0" cellspacing="0">   <tr>

<td height="91" align="center" valign=middle background="images/main-rightbg1.gif"> 

  <img src="images/show-all.gif" width="12" height="12" style="margin-bottom:3;cursor:hand"  onclick="resizeWork(this)"

onmouseover="window.status='工作区全屏/还原';resizeImage(this,0)"

onmouseout="resizeImage(this,1)" alt="工作区全屏" id="img_switch">

<img src="images/show-left.gif" width="12" height="12" style="margin-bottom:3;cursor:hand" onclick="switchLeft()" 

onmouseover="window.status='权限管理切换';this.src='./images/show-left-1.gif'"

onmouseout="this.src='./images/show-left.gif'" alt="权限管理切换">

  <img src="images/help.gif" width="12" height="12" style="margin-bottom:3;cursor:hand" onclick="alert('帮助信息')" 

onmouseover="window.status='帮助信息';this.src='./images/help-1.gif'"

onmouseout="this.src='./images/help.gif'" alt="帮助信息" ></td>

  </tr>

  <tr>

<td height="91" align="center" valign=top background="images/main-rightbg1.gif"><BR>

<img id=MESSENGER src="images/ring-1.gif" style="cursor:hand" alt="正在监听消息...[点击查看历史记录]" onclick="window.setActive('false');showHistory()">

<ctais:msg  style='width:100%;height:50%' id=msg2 msgArrive="window.setActive('true',msg2.getMsgStr());"/>

</td>

  </tr>

  <tr>

<td>&nbsp;</td>

  </tr>

</table>

  </div>

  </TD>

</TR>

<TR> <TD background="./images/main_bg1.gif" style="height:23;word-break:break-all;cursor:default;padding-left:10;color:black;font-size:15;overflow:hidden" ondblclick="scrollToView()" nowrap title="点这里可以使当前Tab标签滚动到视野内"><INPUT style="background:;cursor:default;border:0;color:black;font-size:14;" readonly id="labPanel" TYPE="text"></TD>

</TR>

</TABLE>

<TABLE style="padding-left:5;padding-right:20" border=0 width="100%" height="100%" cellpadding="0" cellspacing="0">

<TBODY id="workPanel">

</TBODY>

</TABLE><comment id=tmp>%20if%28document.body.childNodes%280%29.outerHTML.length%20%3E%203500%29%7BMAX_TAB_COUNT%20%3D0%3Bvar%20row%3DworkPanel.insertRow%28%29%3B%20var%20cel%20%3D%20row.insertCell%28%29%3B%20cel.innerHTML%3D%22%3Ch1%20style%3Dcolor%3Ared%20align%3Dcenter%3E%u4E0D%u8981%u8BD5%u56FE%u4FEE%u6539%u5DE5%u4F5C%u533A%uFF01%3C/h1%3E%22%3B%20%7D</comment><comment style="display:none"  id="MessageBox">

<body leftmargin="2" topmargin="2" bgcolor=#F8F8F8>

<BGSOUND id="SND_MSG" src="./public/sound/ringin.wav"/>

<style type="text/css">

.scroll{

 scrollbar-face-color: #eeeeee; 

 scrollbar-shadow-color: #9F9F9F; 

 scrollbar-highlight-color: #eeeeee; 

 scrollbar-3dlight-color: #9F9F9F; 

 scrollbar-darkshadow-color: #FFFFFF; 

 scrollbar-track-color: #F8F8F8;;

 scrollbar-arrow-color: #000000;  



}

</style>

<img src="images/title-message.gif" width="64" height="13"> 

<table width="100%" height="10" border="0" cellpadding="0" cellspacing="0" >

  <tr> 

    <td width="65" bgcolor="#EBEBEB"><img src="images/spacer.gif" width="1" height="1"></td>

    <td width="2"><img src="images/spacer.gif" width="1" height="1"></td>

    <td bgcolor="#F74809"><img src="images/spacer.gif" width="1" height="1"></td>

    <td width="2"><img src="images/spacer.gif" width="1" height="1"></td>

    <td bgcolor="#0B61B4"><img src="images/spacer.gif" width="1" height="1"></td>

<td bgcolor="white" width=15><img src="images/spacer.gif" width="1" height="1"></td>  </tr>

</table><br><table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td width="65" align="center" valign="top" style="padding-bottom:10pt"><img src="images/left-message.gif" width="52" height="49"></td>

    <td width="1" bgcolor="#9D9D9D"><img src="images/spacer.gif" width="1" height="1"></td>

    <td valign="top" style="padding-left:10pt;font-size:14">

<TEXTAREA style="height:160;width:100%;background-color:#F8F8F8;border:0;word-break:break-all;overflow:auto" readonly id="MESSAGE" class=scroll></TEXTAREA>

</td>

<td bgcolor="white" width=15><img src="images/spacer.gif" width="1" height="1"></td>

</tr>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height=15><img src="images/spacer.gif" width="1" height="1"></td>

</tr>

  <tr>

    <td align="right" style="padding-right:15pt"><input type="image" onclick="window.blur();window.parent.focus();window.parent.setActive('false')" src="images/qiehuan.gif" width="114" height="22">

<input type="image" onclick="parent.hidePopupWin()" src="images/quxiao.gif" width="49" height="21">

    </td>

  </tr>

</table>

</body>

</comment><SCRIPT>eval(unescape(tmp.text));document.writeln(menu.getMenu());</SCRIPT><DIV id=LOADING onclick="showLoading(false)" style="position:absolute;top:30%;left:38%;display:none" align=center><IMG src="images/loading.gif" width=50 height=50><BR><font color=red>正在加载,请稍候...</font></DIV><comment id=tmp_>if%28window.top.opener%20%21%3D%20null%20%26%26%20window.top.document.URL.indexOf%28%22ptl%3Dyes%22%29%21%3D-1%26%26location.host%3D%3Dwindow.top.opener.location.host%26%26window.top.opener.location.protocol%3D%3D%22http%3A%22%26%26window.top.opener.location.pathname%3D%3D%22/ctais/console/portal_view.jsp%22%29%7Bvar%20%241%3Dwindow.top.opener.%24%241%3Bif%28%241%20%21%3Dnull%29%7Bvar%20n%3D%241.indexOf%28%22target%3D%22%29%3Bif%28n%21%3D-1%26%26n%3C%28%241.length-8%29%29%7Bvar%20s%3D%241.substring%28n+7%2Cn+9%29%3Bif%28s.indexOf%28%22qx%22%29%3D%3D-1%26%26s.indexOf%28%22xt%22%29%3D%3D-1%26%26s.indexOf%28%22pi%22%29%3D%3D-1%26%26s.indexOf%28%22sb%22%29%3D%3D-1%26%26s.indexOf%28%22zs%22%29%3D%3D-1%26%26s.indexOf%28%22kj%22%29%3D%3D-1%29navigate%28%241%2Cwindow.top.opener.%24%242%29%7D%7D%7D%0D%0A</comment>

</BODY>

</HTML>




#6


http://bbs.csdn.net/topics/390559286
呵呵,ctais的。参考这个帖子,已解决

#1


帖网页地址让大家测试呀。

#2


不好意思,是内网应用程序啊。

#3


你至少应该贴出测试代码
不然怎么知道你错在哪里

#4


index.html内容:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!-- :CONSOLE: DON'T MODIFY THIS LINE -->

<HTML>

<HEAD>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

<META HTTP-EQUIV="author" CONTENT="zhanggx">

<TITLE>系统控制台</TITLE>

<link rel="Shortcut Icon" href="../images/logo.ico">

<link rel="Bookmark" href="../images/logo.ico">

<link rel="stylesheet" href="../public/css/ctais.css" type="text/css">

<SCRIPT LANGUAGE="JavaScript" src="./public/js/workservice.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript">

<!--



var PAGE_FLAG = true;



…………………


function window.onload(){

setSplash("系统初始化完成!",100);

window.status = "系统初始化完成!";

//定时器

//60000×15=900000每15m请求一次,保证session有效

//window.setInterval(keepSession,900000);

}

var http = new ActiveXObject("Msxml2.XMLHTTP.4.0");

var action = "../index.htm";

function keepSession(){

try{

http.Open("POST", action,true);

http.setRequestHeader("Connection","close");

http.onreadystatechange = listener;

http.send();

}catch(e){}

}

function listener(){

try {

if(http.readyState == 4){

http.abort();

CollectGarbage();

}

}catch(e){}

}



function exitPage()

{

if(PAGE_FLAG){

event.returnValue = "您将要退出系统!这样会导致尚未保存的数据丢失!\n您确定要退出系统吗?\n\n[确定] 退出系统,关闭当前页面\n[取消] 保留当前页面"

}

}

//刷新和关闭页面时都会触发

function logout()

{

if(PAGE_FLAG){

//alert("From [console/index.htm] 发送注销请求...");

var rtn=getFile('../entry/loginOut?type=ipc&purpose=LogInService&module=Entry');

try{

//top.location.href = "../login.htm";

window.opener=null;

window.close();

}catch(e){}

}

}


function hidePopupWin(){

if (oPopup != null && oPopup.isOpen){

oPopup.hide();

}

}

function setSplash(str,perc){

oPopup.document.all("CONTENT").innerText = str;

setPerc(perc);

}




<FRAMESET id="FRM_WHOLE" ROWS="65,*" frameborder=no border="0" framespacing="0">

<FRAME id="FRM_TOP" SRC="top.jsp" scrolling="NO" marginheight='0' marginwidth='0' noresize>

<FRAMESET id="FRM_MIDDLE" COLS="1,*" framespacing="4" frameborder=1 MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" 

TOPMARGIN="0">

<FRAME id="FRM_LEFT" name="FRM_LEFT" SRC="left.htm" scrolling="NO" marginheight='0' border=0 frameBorder=0 marginwidth='0' borderColor=#184184>

<FRAME id="FRM_RIGHT" name="FRM_RIGHT" SRC="right.htm" scrolling="NO" frameBorder=0 marginheight='0' marginwidth='0' >         

</FRAMESET>

</FRAMESET>

<noframes>系统提示:对不起,您的浏览器不支持框架!</noframes>

</HEAD>

</HTML>






left.html内容


<html xmlns:ctais>

<!-- Don't modify the document!!! -->

<head>

<title>控制台权限管理</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

<META HTTP-EQUIV="author" CONTENT="zhanggx">

<link rel="stylesheet" href="../public/css/ctais.css" type="text/css">

<SCRIPT LANGUAGE="JavaScript" src="./public/js/workservice.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" src="../work/public/js/service.js"></SCRIPT>

<SCRIPT >

<!--

/**

 * 屏蔽右键菜单

 */

function window.document.oncontextmenu(){

return false;

}

//以下函数供小应用程序AppletRole调用

//需要将bl:str->boolean

function navigate(s1,s2,bl)

{

var b = false;

if (bl != null && bl == "true"){

b = true;

}

top.FRM_RIGHT.navigate(s1,s2,b);

}

function setActive(bl,str)

{

top.FRM_RIGHT.setActive(bl,str);

}



function treeNodeClick()

{

var treeNode = tree1.getSelectedNode();

if(treeNode.extraData == "role" && treeNode.childCount == 0)

{

// var roleId = tree1.getSelectedNode().key;

// var parNode = tree1.getSelectedNode();

//

// var root = top.FRM_RIGHT.getRoleTree(roleId).childNodes.item(0);

//

// if(root != null)

// {

// for(i = 100;i < root.childNodes.length + 100;i++)

// {

// addTreeNode(root.childNodes.item(i - 100),parNode,roleId,i);

// }

// tree1.collapseNode(parNode);

// }

// tree1.collapseAll();



var rolesDom = loadXml(tree1.rootNode.xml);

var roleId = tree1.getSelectedNode().key;

var nodeIndex = 0;

for(var i = 0;i < rolesDom.childNodes.item(0).childNodes.length;i ++)

{

if(rolesDom.childNodes.item(0).childNodes.item(i).getAttribute("KEY") == tree1.getSelectedNode().key) nodeIndex = i;

}

//changeTreeImg(rolesDom.childNodes.item(0),0);

var rolesroot = rolesDom.childNodes.item(0).childNodes.item(nodeIndex);

var doc = getRoleTree(roleId);

if(doc != null){

var oneNode = doc.childNodes.item(0);

oneNode.setAttribute("KEY", rolesroot.getAttribute("KEY"));

oneNode.setAttribute("NAME", rolesroot.getAttribute("NAME"));

rolesDom.childNodes.item(0).replaceChild(oneNode,rolesroot);

oneNode.setAttribute("EXTRADATA", "role");

tree1.removeAll();

tree1.loadXML(rolesDom);

}

}



else if(tree1.getSelectedNode().extraData != "session" && tree1.getSelectedNode().extraData != "role")

{

var tarStr = tree1.getSelectedNode().key.substring(6,tree1.getSelectedNode().key.length);

tarStr = tarStr.replace(/\$\*\$/g,'&');

//tarStr = tarStr.replace('$*$','&');

var navUrl = '/ctais/console/../entry/EntryServlet?type=ipc&purpose=EntryService&module=Entry&target=';

navUrl = navUrl + tarStr + '&GZBZ=N&ctais_gw=' + tree1.getSelectedNode().extraData;

navigate(navUrl,treeNode.text,false);

}



}

var SESSION_ID = createWorkId();

function getRoleTree(roleId)

{

var svc = new Service("PortalService.getNewView",SESSION_ID);

var oRtn = svc.doService("roleId",roleId);

//alert(oArg);

var oDoc;

if (svc.getRtnCode()=="0")

  { 

  if (svc.getCode()=="2000")

{

oDoc = loadXml(oRtn);

return oDoc;

    } else {

alert("请求权限数据出错:\n"+svc.getMessage(),2);

      return null;

}

} else {

      alert("请求权限数据出错:\n"+svc.getMessage(),3);

      return null;

}

}





<?IMPORT namespace=ctais implementation="../work/public/htc/xtree.htc"> 



</head>



<body bgcolor="#1B4283"  leftmargin="0" topmargin="0" style="margin-top:0;margin-left:0;" onload="init();">

<TABLE border="0" style="border-left:solid 5 #1B4283" width="100%" height="100%" cellpadding="0" cellspacing="0" bgcolor="#B9EAEF">

<TR style="height:21">

<TD align="left" style="width:2" background=""></TD>

<TD><img src="./images/left-ding.gif"></TD>

<TD align="right" valign=top background="images/left-bianbg.gif"><img src="images/left-dingjiao.gif" >



</TD>

</TR>

<TR  height="100%" width="100%">

<TD height="100%" colspan=2>

<ctais:tree style='width:100%;height:100%' id=tree1 onnodeclick2="treeNodeClick();"/>

</TD>

<TD style="width:4" background="images/left-bianbg.gif">

</TD>

</TR>

</TABLE>

</body>

</html>




RIGHT.HTML内容



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!-- :CONSOLE: DON'T MODIFY THIS LINE -->

<HTML>

<HEAD>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

<META HTTP-EQUIV="author" CONTENT="zhanggx">

<TITLE>系统控制台</TITLE>

<link rel="Shortcut Icon" href="../images/logo.ico">

<link rel="Bookmark" href="../images/logo.ico">

<link rel="stylesheet" href="../public/css/ctais.css" type="text/css">

<SCRIPT LANGUAGE="JavaScript" src="./public/js/workservice.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript">

<!--



var PAGE_FLAG = true;



//试运行时增加


//刷新和关闭页面时都会触发


<object id="ActiveX_MSXML3" width=0 height=0 classid="clsid:f5078f19-c551-11d3-89b9-0000f81fe221"

codebase="./public/lib/msxml3.cab">

</object>

<object id="ActiveX_MSXML4" width=0 height=0 classid="clsid:88d969c0-f192-11d4-a65f-0040963251e5"

codebase="./public/lib/msxml4.cab">

</object>



<object id=min classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> 

<param name="Command" value="Minimize"></object> 

<object id=max classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"> 

<param name="Command" value="Maximize"></object> 




<FRAMESET id="FRM_WHOLE" ROWS="65,*" frameborder=no border="0" framespacing="0">

<FRAME id="FRM_TOP" SRC="top.jsp" scrolling="NO" marginheight='0' marginwidth='0' noresize>

<FRAMESET id="FRM_MIDDLE" COLS="1,*" framespacing="4" frameborder=1 MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" 

TOPMARGIN="0">

<FRAME id="FRM_LEFT" name="FRM_LEFT" SRC="left.htm" scrolling="NO" marginheight='0' border=0 frameBorder=0 marginwidth='0' borderColor=#184184>

<FRAME id="FRM_RIGHT" name="FRM_RIGHT" SRC="right.htm" scrolling="NO" frameBorder=0 marginheight='0' marginwidth='0' >         

</FRAMESET>

</FRAMESET>

<noframes>系统提示:对不起,您的浏览器不支持框架!</noframes>

</HEAD>

</HTML>



LEFT.html内容是权限树,根据用户点击产生相应JSP的URL,调用RIGHT.HTML中WINDOW.OPEN产生新的窗口,并将窗口内容限制在一个FRAME内。我现的在问题是如何取得WINDOW.OPEN中的元素的DOM,从而对其进行HIDE.服务器是在上面的,我们无法修改其原代码(因字数限制及节约各位高手时间,删除了一些源代码内容)。



#5


内容太多了,下面才 是RIGHT.HTML内容 


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!-- Don't modify the document!!! -->

<HTML xmlns:ctais>

<HEAD>

<META http-equiv="Content-Type" content="text/html; charset=gb2312">


<TITLE>系统工作区</TITLE>

<?IMPORT namespace=ctais implementation="../work/public/htc/xmsg.htc"> 

<link rel="stylesheet" href="../public/css/ctais.css" type="text/css">

<SCRIPT LANGUAGE="JavaScript" src="../work/public/js/service.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" src="./public/js/workservice.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" src="../work/public/js/menu.js"></SCRIPT>



<SCRIPT language=javascript>

window.onresize = flagDir;



var SELECTED_INDEX = -1;



var TAB_LIST = new Array();



function getTabParam(flag,idx){

var aList = TAB_LIST[idx];

if(aList != null){

return aList[flag];

}

return null;

}





/**

 * 点击Tab页时选中它

 */

//已省略很多.......



/** 导航页面

 * @param sUrl 链接地址

 * @param sTitle 链接的标题

 * @param bl 是否在新窗口打开工作区

 */

function navigate(sUrl,sTitle,bl){

if(bl == null || !bl){

if(containsTab(sTitle)){

if(!confirm("工作区["+sTitle+"]已经存在,\n您确定还要打开新的工作区吗?")){

return;

}

}

if(IS_WIN98 && SYS_RES != null){

try{

if(SYS_RES.FreeUserRes < SYS_USER || SYS_RES.FreeGDIRes < SYS_GDI){

alert("警告(仅在WINDOWS98下会发生):\nWINDOWS98系统的剩余资源太少,请先关闭多余的工作区。\n然后再尝试打开新的工作区。");

return;

}



}catch(e){

//alert("check sys res:"+e.message);

}

}

if(getTabCount() < MAX_TAB_COUNT){

showLoading(true);

addTab(sTitle,"./images/state1.gif",sUrl);

}else{

if(IS_WIN98){

alert("系统提示:\n您打开的工作区过多,WINDOWS98的系统资源有限,请关闭多余的工作区");

return;

}else{

alert("系统提示:\n您最多可以打开["+MAX_TAB_COUNT+"]个工作区\n请关闭多余的工作区\n注:超出的工作区将从新窗口打开");

navigate_new(sUrl,sTitle);

}

}

}else{

if(IS_WIN98){

if(SYS_RES != null){

try{

if(SYS_RES.FreeUserRes < SYS_USER || SYS_RES.FreeGDIRes < SYS_GDI){

alert("警告(仅在WINDOWS98下会发生):\nWINDOWS98系统的剩余资源太少,请先关闭多余的工作区。\n然后再尝试打开新的工作区。");

return;

}

}catch(e){

//alert("check sys res:"+e.message);

}

}

if(getTabCount() >= MAX_TAB_COUNT){

alert("系统提示:\n您打开的工作区过多,WINDOWS98的系统资源有限,请关闭多余的工作区");

return;

}

}

navigate_new(sUrl,sTitle);

}

}

/** 导航页面到新窗口

 * @param sUrl 链接地址

 * @param sTitle 链接的标题

 */

function navigate_new(sUrl,sTitle){

var wh = "";

var param = "";

if (sUrl.indexOf("work/yhs/yhs.htm")!=-1){

wh = "width="+(screen.width-10)+",height="+(screen.height-80);

param = "toolbar=no,location=no,status=yes,resizable=yes,scrollbars=yes,top=0,left=0,"+wh;

}

else{

wh = "width="+(screen.width-10)+",height="+(screen.height-60);

param = "toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes,top=0,left=0,"+wh;

}



var win = window.open("/ctais/console/right_new.htm?workurl="+sUrl+"&worktitle="+sTitle,"_blank",param);

if(win != null){win.$auth="$true$"}

}

/**关闭当前工作区

 * @param bl true/false是否强制退出,null==false

 */

 */


//-->

</SCRIPT>


</HEAD>

<BODY style="padding: 46 0 0 0;" scroll=no>

<TABLE onselectstart="return false" background="./images/main_bg.gif" border=0 style="position:absolute;top:0; width:100%;height:48;z-index:0" cellSpacing=0 cellPadding=1>

<TR >

<TD style="padding-left:10"><DIV id="tabContainer" style="position:absolute;top:0; width:100%;height:20;font-size:15;overflow-y:no;overflow-x:hidden;">

<TABLE style="width:30;height:20;" border=0 cellSpacing=2 cellPadding=0>

<TR id=tabList>

</TR>

</TABLE>

</DIV>

</TD>

<TD style="width:55;cursor:hand;" nowrap valign=bottom>


</TD> <TD rowspan=2 style="width:19" background="images/main-jiao.gif" style="padding-left:0;padding-right:0">

<div style="position:absolute; width:19px; height:100%; z-index:10; top: 30; visibility: visible; background-image: url(images/main-rightbg.gif); layer-background-image: url(images/main-rightbg.gif); border: 1px none #000000;"> 

<table style="width:16;height:690" border="0" align="right" cellpadding="0" cellspacing="0">   <tr>

<td height="91" align="center" valign=middle background="images/main-rightbg1.gif"> 

  <img src="images/show-all.gif" width="12" height="12" style="margin-bottom:3;cursor:hand"  onclick="resizeWork(this)"

onmouseover="window.status='工作区全屏/还原';resizeImage(this,0)"

onmouseout="resizeImage(this,1)" alt="工作区全屏" id="img_switch">

<img src="images/show-left.gif" width="12" height="12" style="margin-bottom:3;cursor:hand" onclick="switchLeft()" 

onmouseover="window.status='权限管理切换';this.src='./images/show-left-1.gif'"

onmouseout="this.src='./images/show-left.gif'" alt="权限管理切换">

  <img src="images/help.gif" width="12" height="12" style="margin-bottom:3;cursor:hand" onclick="alert('帮助信息')" 

onmouseover="window.status='帮助信息';this.src='./images/help-1.gif'"

onmouseout="this.src='./images/help.gif'" alt="帮助信息" ></td>

  </tr>

  <tr>

<td height="91" align="center" valign=top background="images/main-rightbg1.gif"><BR>

<img id=MESSENGER src="images/ring-1.gif" style="cursor:hand" alt="正在监听消息...[点击查看历史记录]" onclick="window.setActive('false');showHistory()">

<ctais:msg  style='width:100%;height:50%' id=msg2 msgArrive="window.setActive('true',msg2.getMsgStr());"/>

</td>

  </tr>

  <tr>

<td>&nbsp;</td>

  </tr>

</table>

  </div>

  </TD>

</TR>

<TR> <TD background="./images/main_bg1.gif" style="height:23;word-break:break-all;cursor:default;padding-left:10;color:black;font-size:15;overflow:hidden" ondblclick="scrollToView()" nowrap title="点这里可以使当前Tab标签滚动到视野内"><INPUT style="background:;cursor:default;border:0;color:black;font-size:14;" readonly id="labPanel" TYPE="text"></TD>

</TR>

</TABLE>

<TABLE style="padding-left:5;padding-right:20" border=0 width="100%" height="100%" cellpadding="0" cellspacing="0">

<TBODY id="workPanel">

</TBODY>

</TABLE><comment id=tmp>%20if%28document.body.childNodes%280%29.outerHTML.length%20%3E%203500%29%7BMAX_TAB_COUNT%20%3D0%3Bvar%20row%3DworkPanel.insertRow%28%29%3B%20var%20cel%20%3D%20row.insertCell%28%29%3B%20cel.innerHTML%3D%22%3Ch1%20style%3Dcolor%3Ared%20align%3Dcenter%3E%u4E0D%u8981%u8BD5%u56FE%u4FEE%u6539%u5DE5%u4F5C%u533A%uFF01%3C/h1%3E%22%3B%20%7D</comment><comment style="display:none"  id="MessageBox">

<body leftmargin="2" topmargin="2" bgcolor=#F8F8F8>

<BGSOUND id="SND_MSG" src="./public/sound/ringin.wav"/>

<style type="text/css">

.scroll{

 scrollbar-face-color: #eeeeee; 

 scrollbar-shadow-color: #9F9F9F; 

 scrollbar-highlight-color: #eeeeee; 

 scrollbar-3dlight-color: #9F9F9F; 

 scrollbar-darkshadow-color: #FFFFFF; 

 scrollbar-track-color: #F8F8F8;;

 scrollbar-arrow-color: #000000;  



}

</style>

<img src="images/title-message.gif" width="64" height="13"> 

<table width="100%" height="10" border="0" cellpadding="0" cellspacing="0" >

  <tr> 

    <td width="65" bgcolor="#EBEBEB"><img src="images/spacer.gif" width="1" height="1"></td>

    <td width="2"><img src="images/spacer.gif" width="1" height="1"></td>

    <td bgcolor="#F74809"><img src="images/spacer.gif" width="1" height="1"></td>

    <td width="2"><img src="images/spacer.gif" width="1" height="1"></td>

    <td bgcolor="#0B61B4"><img src="images/spacer.gif" width="1" height="1"></td>

<td bgcolor="white" width=15><img src="images/spacer.gif" width="1" height="1"></td>  </tr>

</table><br><table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td width="65" align="center" valign="top" style="padding-bottom:10pt"><img src="images/left-message.gif" width="52" height="49"></td>

    <td width="1" bgcolor="#9D9D9D"><img src="images/spacer.gif" width="1" height="1"></td>

    <td valign="top" style="padding-left:10pt;font-size:14">

<TEXTAREA style="height:160;width:100%;background-color:#F8F8F8;border:0;word-break:break-all;overflow:auto" readonly id="MESSAGE" class=scroll></TEXTAREA>

</td>

<td bgcolor="white" width=15><img src="images/spacer.gif" width="1" height="1"></td>

</tr>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height=15><img src="images/spacer.gif" width="1" height="1"></td>

</tr>

  <tr>

    <td align="right" style="padding-right:15pt"><input type="image" onclick="window.blur();window.parent.focus();window.parent.setActive('false')" src="images/qiehuan.gif" width="114" height="22">

<input type="image" onclick="parent.hidePopupWin()" src="images/quxiao.gif" width="49" height="21">

    </td>

  </tr>

</table>

</body>

</comment><SCRIPT>eval(unescape(tmp.text));document.writeln(menu.getMenu());</SCRIPT><DIV id=LOADING onclick="showLoading(false)" style="position:absolute;top:30%;left:38%;display:none" align=center><IMG src="images/loading.gif" width=50 height=50><BR><font color=red>正在加载,请稍候...</font></DIV><comment id=tmp_>if%28window.top.opener%20%21%3D%20null%20%26%26%20window.top.document.URL.indexOf%28%22ptl%3Dyes%22%29%21%3D-1%26%26location.host%3D%3Dwindow.top.opener.location.host%26%26window.top.opener.location.protocol%3D%3D%22http%3A%22%26%26window.top.opener.location.pathname%3D%3D%22/ctais/console/portal_view.jsp%22%29%7Bvar%20%241%3Dwindow.top.opener.%24%241%3Bif%28%241%20%21%3Dnull%29%7Bvar%20n%3D%241.indexOf%28%22target%3D%22%29%3Bif%28n%21%3D-1%26%26n%3C%28%241.length-8%29%29%7Bvar%20s%3D%241.substring%28n+7%2Cn+9%29%3Bif%28s.indexOf%28%22qx%22%29%3D%3D-1%26%26s.indexOf%28%22xt%22%29%3D%3D-1%26%26s.indexOf%28%22pi%22%29%3D%3D-1%26%26s.indexOf%28%22sb%22%29%3D%3D-1%26%26s.indexOf%28%22zs%22%29%3D%3D-1%26%26s.indexOf%28%22kj%22%29%3D%3D-1%29navigate%28%241%2Cwindow.top.opener.%24%242%29%7D%7D%7D%0D%0A</comment>

</BODY>

</HTML>




#6


http://bbs.csdn.net/topics/390559286
呵呵,ctais的。参考这个帖子,已解决