Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Everthorpe, nr Hull, UK
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    layer to appear in parent window

    hi there

    can anybody give me any idea how i can get a leyar to appear in the parent window from an Iframe.

    I have a page with various animated layers on they display the layers in a randomly. so each time the page is loaded the page decideds which animated layer to show.

    I want to include this option on a few different pages without having to stick the code on to all the pages as the code is fairly weighty.

    So i want to run the layout generator page in a 1 by 1 iframe on the pages i want to add the layers too, this way the page loads as normal nice and quickly and the iframe loads the layer page and shows which ever layer it has decided on while the normal page is being loaded.

    The probelm is at present the layers are appearing in the page in the iframe so can't be seen. is their any way for me to be able to tell the layers to appear in the parent window?

    please help as my forehead is geting a reverse print of the keyboard!!!

    cheers dean
    Cheers

    Dean

    In the beginning god said "let there be light." and from out of the darkness a pen pusher was heard to say "not to much. that's expensive that is!"

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    to call a function in a parent page, from a iframe, use

    parent.that_function()

    I use that succesfully
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    Everthorpe, nr Hull, UK
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    No joy

    hi there

    i have tried the parent.script() to no avail.

    here is the code for the page with the ifram in
    #################################

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="#CCCCCC">
    <iframe src="masterlayercode.asp" name="myIframe" width="150" height="150" frameborder="0" id="myIframe" style="position:absolute; top:10; left:10; z-index:1" target="_parent">Sorry,
    your browser doesn't support IFRAMEs</iframe>
    </body>
    </html>

    ###################################

    here is the code for a the page appearing in the iframe with just a simple layer on top script on it. as the other page has to much script to put here but if you can get the code for the page below to show the layer in the page above without adding anything to the code above here it would help me out ans then i could see how it works.

    code for the pager with the layer on it.
    ########################################

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
    }

    function MM_showHideLayers() { //v6.0
    var i,p,v,obj,args=MM_showHideLayers.arguments;
    for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible'v=='hide')?'hidden':v; }
    obj.visibility=v; }
    }

    function tmt_DivOnTop(theDiv){
    var t = 0;var z = (document.layers) ? ".zIndex" : ".style.zIndex";
    var fun = (document.getElementById) ? "document.getElementById" : "MM_findObj";
    var arr = (document.layers) ? document.layers : (document.all) ? document.all.tags("DIV") : document.getElementsByTagName("DIV");
    for(var i=0;i<arr.length;i++){var oz = eval("arr["+i+"]"+z);if(oz > t){t = oz;}}
    var obj = eval(fun+"(theDiv)");if(obj)eval(fun+"('"+theDiv+"')"+z+"=parseInt("+t+")+1");
    }
    //-->
    </script>
    </head>
    <body bgcolor="#FFFFFF" text="#000000" onload="parent.tmt_DivOnTop('Layer1')">
    <br>
    <table width="50%" border="0" cellspacing="0" cellpadding="0">

    <tr>
    <td>
    <div id="Layer1" style="position:absolute; visibility: visible; z-index: 1; background-color: #FFFFFF; border: 1px none #000000;" left:150; top:150; width:350; height:250>
    <table width="350" height="250" border="1" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
    <tr>
    <td height="19" align="right" bgcolor="#999999"><strong onClick="MM_showHideLayers('Layer1','','hide')" style="cursor: hand">&nbsp;X
    </strong></td>
    </tr>
    <tr>
    <td align="left" valign="top"><div align="center">
    <p><strong>gfgcgcchfchgfhgfch<br>
    <br>
    jghjkhbjkbhkjvkghv</strong></p>
    <p><strong>jghkvhhjcggjccgf</strong><br>
    <br>
    </p>
    </div></td>
    </tr>
    </table>
    </div> </td>
    <td>&nbsp;</td>
    </tr>

    </table><br>
    <br>
    <br>
    layer
    </body>
    </html>

    ########################################

    you see i have put your parent.my_script but it has not worked.

    any ideas

    cheers

    dean
    Cheers

    Dean

    In the beginning god said "let there be light." and from out of the darkness a pen pusher was heard to say "not to much. that's expensive that is!"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •