The code for this change is as follows:
Interface Front-end:
Copy codeThe Code is as follows:
<% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "AdmShowDIV. aspx. cs" Inherits = "ExamSystemV3.Manager. RoleManager. AdmShowDIV" %>
<! DOCTYPE html>
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Meta name = "Author" content = "kudychen@gmail.com"/>
<Meta http-equiv = "X-UA-Compatible" content = "IE = EmulateIE7"/>
<Title> </title>
<Script src = ".../../js/DIV/jquery. js" type = "text/javascript"> </script>
<Script src = ".../../js/DIV. js" type = "text/ecmascript"> </script>
<Link href = ".../../css/admin.global.css" rel = "stylesheet" type = "text/css"/>
<Link href = ".../../css/admin.content.css" rel = "stylesheet" type = "text/css"/>
<Script type = "text/javascript" src = "..././js/jquery. easyui. min. js"> </script>
<Script type = "text/javascript" src = ".../javascript/jquery-1.4.2.min.js"> </script>
<Script type = "text/javascript" src = ".../js/jquery. utils. js"> </script>
<Link href = ".../../jBox/Skins/Green/jbox.css" rel = "stylesheet" type = "text/css"/>
<Script type = "text/javascript" src = ".../jBox/jquery. jBox-2.3.min.js"> </script>
<Script type = "text/javascript" src = ".../js/admin. js"> </script>
<Script type = "text/javascript" src = ".../js/SimpleTree. js"> </script>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div class = "container">
<Div class = "location"> current location: Interface Element Management-> View interface elements </div>
<Div class = "blank10"> </div>
<Div class = "search block">
<Div class = "h">
<Span class = "icon-sprite icon-magnifier"> </span>
<H3> quick search </Div>
<Div class = "tl corner"> </div> <div class = "tr corner"> </div> <div class = "bl corner"> </div> <div class = "br corner"> </div>
<Div class = "cnt-wp">
<Div class = "cnt">
<Div class = "search-bar" id = "SelectRole">
<Label class = "txt-green"> select the page: </label>
<Asp: DropDownList ID = "DdlWindowsName" runat = "server" AutoPostBack = "True" OnSelectedIndexChanged = "DdlWindowsName_SelectedIndexChanged">
</Asp: DropDownList>
<A class = "btn-Example" href = "#" onclick = "WindowsInfo ()"> <span> scan interface information </span> </a>
</Div>
</Div>
</Div>
</Div>
</Div>
<Div class = "block">
<Div class = "h">
<Span class = "icon-sprite icon-list"> </span>
<H3> page details </Div>
<Div class = "tl corner"> </div>
<Div class = "tr corner"> </div>
<Div class = "bl corner"> </div>
<Div class = "br corner"> </div>
<Div class = "cnt-wp">
<Div class = "cnt">
<Iframe id = "frmWindows" runat = "server" frameborder = "0" marginheight = "0" marginwidth = "0" scrolling = "auto" style = "display: inline; height: 400px; "width =" 75% "> </iframe>
<Iframe id = "frmUpdateDIV" runat = "server" frameborder = "0" marginheight = "0" marginwidth = "0" scrolling = "auto" style = "display: inline; height: 400px; width: 24%; "> </iframe>
</Div>
</Div>
</Div>
</Form>
</Body>
</Html>
Interface Background:
Copy codeThe Code is as follows:
Using BLL. Manager. RoleUserManagerBLL;
Using System;
Using System. Collections. Generic;
Using System. Data;
Using System. Linq;
Using System. Web;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Namespace ExamSystemV3.Manager. RoleManager
{
Public partial class AdmShowDIV: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
String strLike = "";
If (! IsPostBack)
{
// Binding Interface
DataBindWindows (strLike );
}
}
/// <Summary>
/// Bind all interfaces
/// </Summary>
/// <Param name = "strLike"> </param>
Public void DataBindWindows (string strLike)
{
DataTable dt = new DataTable ();
AdmWindowsManager admWindowsManager = new AdmWindowsManager ();
// Find all interfaces
Dt = admWindowsManager. queryjavaswinfo (strLike );
// Bind the Interface Information
DdlWindowsName. DataSource = dt;
DdlWindowsName. DataValueField = "Id ";
DdlWindowsName. DataTextField = "WindowsName ";
DdlWindowsName. DataBind ();
}
Protected void DdlWindowsName_SelectedIndexChanged (object sender, EventArgs e)
{
DataTable dt = new DataTable ();
String strLike = "";
AdmWindowsManager admWindowsManager = new AdmWindowsManager ();
// Check the Interface Information
Dt = admWindowsManager. queryjavaswinfo (strLike );
String strWindowsId = DdlWindowsName. SelectedValue. ToString (). Trim ();
StrLike = "Id = '" + strWindowsId + "'";
DataRow [] rows = dt. Select (strLike );
// Obtain the path
String strURL = rows [0] ["WindowsURL"]. ToString ();
StrURL = ".../" + strURL;
FrmWindows. Attributes ["src"] = strURL;
FrmUpdateDIV. Attributes ["src"] = "AdmUpdateDIV. aspx? WindowsID = '"+ strWindowsId + "'";
}
}
}
JS:
Copy codeThe Code is as follows:
Var WindowsID;
Function WindowsInfo (){
// Obtain ifrm
Var frmWindows = document. getElementById ("frmWindows"). contentWindow;
// Obtain the interface ID
WindowsID = document. getElementById ("DdlWindowsName"). value;
Var rootboxs = frmWindows.doc ument. getElementById ("main ");
Var child = rootboxs. childNodes;
Findchildbox (child );
};
// Search for subnodes
Function findchildbox (parentNode ){
For (var I = 0; I <parentNode. length; I ++ ){
If (parentNode [I]. nodeName = "BOX "){
Var childboxId = parentNode [I]. id;
Var childboxTitle = encodeURI (parentNode [I]. title );
Var parentbox = findparentbox (parentNode [I]. parentNode );
Var parentboxId = parentbox. id;
If (window. XMLHttpRequest ){
// IE7 abve, firefox, chrome ^
Xmlhttp = new XMLHttpRequest ();
// To be compatible with some javasillar browsers, failure to respond to problems caused by a response from the server starting with xml
If (xmlhttp. overrideMimeType ){
Xmlhttp. overrideMimeType ('text/xml ');
}
}
Else if (window. ActiveXObject ){
// IE5 \ IE6
Xmlhttp = new activeXObject ("Microsoft. XMLHTTP ");
}
If (xmlhttp = null | xmlhttp = undefined ){
Alert ("con't create XMLHttpRequest Object ");
}
/// Register the callback function
// Xmlhttp. onreadystatechange = callback;
// Send information
Xmlhttp. open ('get', '.../Manager/RoleManager/AddBox. ashx? ChildboxId = '+ childboxId +' & childboxTitle = '+ childboxTitle +' & parentboxId = '+ parentboxId +' & windowsId = '+ WindowsID, true );
Xmlhttp. send (null );
// Function callback (){
/// Determine whether the interaction is complete and whether the result is returned correctly
// If (xmlhttp. readyState = 4 & xmlhttp. status = 200 ){
//}
//}
}
Findchildbox (parentNode [I]. childNodes)
}
}
// Query the parent node
Function findparentbox (child ){
If (child. nodeName = "BOX "){
Return child;
} Else {
Return findparentbox (child. parentNode)
}
}
General handler:
Copy codeThe Code is as follows:
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Web;
Using BLL. Manager. RoleUserManagerBLL;
Using System. Data;
Using System. Text;
Using Model;
Using BLL;
Namespace ExamSystemV3.Manager. RoleManager
{
/// <Summary>
/// AddBox Summary
/// </Summary>
Public class AddBox: IHttpHandler
{
Public void ProcessRequest (HttpContext context)
{
Context. Response. ContentType = "text/plain ";
System. Threading. Thread. Sleep (1000 );
DIVEntity EDiv = new DIVEntity ();
TR_WindowsDIVEntity EWindowsDiv = new TR_WindowsDIVEntity ();
AdmDIVManager admDIVManager = new AdmDIVManager ();
PublicBLL publicBll = new PublicBLL ();
/// Collect information
String strChildBoxId = "";
String strChildBoxTitle = "";
StrChildBoxId = context. Request. QueryString ["childboxId"]. ToString (). Trim ();
StrChildBoxTitle = context. Server. UrlDecode (context. Request. QueryString ["childboxTitle"]. ToString (). Trim ());
String strWindowsId = context. Request. QueryString ["windowsId"]. ToString (). Trim ();
String strParentBoxId = context. Request. QueryString ["parentboxId"]. ToString (). Trim ();;
String strState = "yes ";
String strDateTime = publicBll. GetDate ();
String strIP = publicBll. GetWebClientIp ();
String strOperator = "xvshu"; // context. Session ["UserNo"]. ToString (). Trim ();;
// Assign values to the object class
EDiv. Id = strChildBoxId;
EDiv. MainRelation = strParentBoxId;
EDiv. DIVName = strChildBoxTitle;
EDiv. DIVDescribe = strChildBoxTitle;
EDiv. Operator = strOperator;
EDiv. OperatorIP = strIP;
EDiv. State = strState;
EDiv. DateTime = strDateTime;
// Assign a value to the WindowsDIV object class
EWindowsDiv. DIVID = strChildBoxId;
EWindowsDiv. WindowsID = strWindowsId;
EWindowsDiv. IsVisible = "yes ";
EWindowsDiv. Operator = strOperator;
EWindowsDiv. OperatorIP = strIP;
EWindowsDiv. DateTime = strDateTime;
// Add a DIV
AdmDIVManager. AddDIV (EDiv, EWindowsDiv );
}
Public bool IsReusable
{
Get
{
Return false;
}
}
}
}