Compile js on the page of iframe to create a div for expanding and shrinking the animation effect in the parent window (without changing the iframe parent window code)

Source: Internet
Author: User

Copy codeThe Code is as follows:
<% @ Page contentType = "text/html; charset = GBK" language = "java" %>
<% @ Page import = "com. jstrd. mm. business. sysmgr. monitor. logic. MMStock2BudgetLogic" %>
<%
String query = request. getParameter ("query ");
MMStock2BudgetLogic bean = new MMStock2BudgetLogic ();
String xmldata = bean. statStock2Budget ();
%>
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = GBK">
<META HTTP-EQUIV = "Pragma" CONTENT = "no-cache">
<META HTTP-EQUIV = "Cache-Control" CONTENT = "no-cache">
<META HTTP-EQUIV = "Expires" CONTENT = "0">
<Title> total purchase expenditure ratio of inventory Points </title>
<Link rel = "stylesheet" href = "<% = request. getContextPath () %>/plugins/FusionCharts/Style.css" type = "text/css"/>
<Link rel = "stylesheet" href = "<% = request. getContextPath () %>/framework/sys-resources/css/jsoa.css" type = "text/css"/>
<Script language = "JavaScript" src = "<% = request. getContextPath () %>/plugins/FusionCharts. js"> </script>
<Script language = "JavaScript" src = "<% = request. getContextPath () %>/plugins/jquery-1.6.4.min.js"> </script>
<Script language = "JavaScript" src = "<% = request. getContextPath () %>/framework/sys-resources/js/common_js/common. js"> </script>
<Script language = "javascript">
Var pageName = "530005.jsp ";
$ (Function (){
If ($ ('# data_chartdiv'). val ()! = ''){
ShowCharts ("Line", "chartdiv", 231,160 );
}
});
Function showCharts (chartType, divId, width, height ){
$ ('#' + DivId). show ();
Var data = $ ('# data _' + divId). val ();
Var chart = new FusionCharts ("<% = request. getContextPath () %>/plugins/FusionCharts/"+ chartType + ". swf "," "+ divId +" "," "+ width +" "," "+ height +" "," 0 "," 0 ");
Chart. setDataXML ('<? Xml version = "1.0" encoding = "gbk"?> '+ Data );
Chart. render ("" + divId + "");
}
</Script>
<Script type = "text/javascript">
Var oMenu;
Function createHtml (){
Try {
// OMenu = paipaiparent.doc ument. getElementById ("_ div_viewcharts ");
// If (null = oMenu | undefined = oMenu ){
Var url1 = "<% = request. getContextPath () %>/framework/login_sso.jsp? Query = <% = query %> & infokey = checkuser & rand = "+ Math. random ();
Var url2 = "<% = request. getContextPath () %>/framework/login_sso.jsp? Query = <% = query %> & target =/stat_report_jsps/fusioncharts_jsps/53000501.jsp& rand = "+ Math. random ();
$. Post (url1, function (data ){
Data = eval ('+ data + ')');
// Alert (data. msg );
If (1 = data. ret ){
Var o = document. getElementById ("_ div_viewcharts ");
Response response parent.doc ument. body. appendChild (o );
OMenu = paipaiparent.doc ument. getElementById ("_ div_viewcharts ");
Var ifrm = getIFrame ();
OMenu. style. left = eval (getAbsoluteLeft (ifrm) + ifrm. offsetWidth) + "px ";
OMenu. style. top = getAbsoluteTop (ifrm) + "px ";
OMenu. innerHTML = '<iframe src = "' + url2 + '" width = "100%" height = "100%" frameborder = "0" scrolling = "no"> </iframe>';
//
$ ('# PTip'). text ('× close <');
OMenu. style. display = "block ";
FnLarge ();
}
});
//}
} Catch (e ){}
}
//
Var w = 0;
Var h = 0;
Var mout;
Function emotion (){
Try {
If (w <= 50 ){
OMenu = paipaiparent.doc ument. getElementById ("_ div_viewcharts ");
If (null = oMenu | undefined = oMenu ){
CreateHtml ();
} Else {
$ ('# PTip'). text ('× close <');
OMenu. style. display = "block ";
FnLarge ();
}
// $ (OMenu). show ("slow ");
} Else {
$ ('# PTip'). text ('+ expand> ');
FnSmall ();
// $ (OMenu). hide ("slow ");
}
} Catch (e ){}
}
Function fnLarge (){
Try {
If (w <780 ){
W + = 50;
H + = 30;
OMenu. style. width = w + "px ";
OMenu. style. height = h + "px ";
Window. setTimeout ("fnLarge ()", 3 );
}
} Catch (e ){}
}
Function fnSmall (){
Try {
If (w> 0 ){
W-= 50;
H-= 30;
OMenu. style. width = w + "px ";
OMenu. style. height = h + "px ";
Window. setTimeout ("fnSmall ()", 3 );
} Else {
OMenu. style. display = "none ";
}
} Catch (e ){}
}
Function mouseOverBody (){
If (null! = OMenu & "none" = oMenu. style. display & w> 0 ){
Emotion ();
}
}
Function getIFrame () {// IE6.0 +
If (parent ){
Var f = parent.doc ument. getElementsByTagName ("IFRAME ");
For (var I = 0; I <f. length; I ++ ){
If (f [I]. contentWindow = self ){
Return f [I];
}
}
}
}
// Get absolute TOP position
Function getAbsoluteLeft (ob ){
If (! Ob) {return null ;}
Var mendingOb = ob;
Var mendingLeft = mendingOb. offsetLeft;
While (mendingOb! = Null & mendingOb. offsetParent! = Null & mendingOb. offsetParent. tagName! = "BODY "){
MendingLeft + = mendingOb. offsetParent. offsetLeft;
MendingOb = mendingOb. offsetParent;
}
Return mendingLeft;
}
// Get absolute TOP position
Function getAbsoluteTop (ob ){
If (! Ob) {return null ;}
Var mendingOb = ob;
Var mendingTop = mendingOb. offsetTop;
While (mendingOb! = Null & mendingOb. offsetParent! = Null & mendingOb. offsetParent. tagName! = "BODY "){
MendingTop + = mendingOb. offsetParent. offsetTop;
MendingOb = mendingOb. offsetParent;
}
Return mendingTop;
}
</Script>
<Style type = "text/css">
Body {margin: 0; padding: 0 ;}
P {cursor: pointer; margin: 0; padding: 0; font-size: 12px; display: inline ;}
</Style>
</Head>
<Body>
<Div class = "tit-05">
<Div style = "float: left; color: gray;"> Inventory to purchase expense ratio </div>
<Div style = "float: right; color: gray;" onclick = "emotion ();" onmouseover = "mouseOverBody () "> <p id =" pTip "> + expand> </p> </div>
</Div>
<Div class = "insL04-ins">
<Div id = "chartdiv" style = "float: left; display: none;"> </div>
</Div>
<Input type = "hidden" id = "data_chartdiv" value = "<% = xmldata %>"/>
<Div id = "_ div_viewcharts" style = "position: absolute; border: 2px solid lightblue; filter: alpha (opacity = 80);-moz-opacity: 0.8; -khtml-opacity: 0.8; opacity: 0.8; background: # fff; margin: 1px auto; overflow: hidden; display: none; padding: 0px; ">
</Div>
</Body>
</Html>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.