SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    body onload inside iframe

    Ok, now I am refining my question. Below is a schematic of my situation

    ----my Javascript code here----
    <script>
    </script>
    </html>
    <body>
    <div id="content">
    ---form controls in "left"------
    <div id ="left">
    <div id="right">
    <Iframe id="there" src="0.html">
    ---inside 0.html------
    <body onload="">

    previously I have used "onload" in the Iframe, this only works with mozilla and possibly IE6. Can't tell as I have a mac and have IE5mac. This is the code that I have used previously:

    Code:
    <iframe SRC="0.html#Pg1" onload="showObj('Pg'+document.forms['chapage'].elements['pge'].value);
    		alert('loaded');" name="there" id="there" width="100%"
    		 height="100%" Frameborder="0" marginheight="0" marginwidth="0" scrolling="yes" >
    		</iframe>
    here is the javascript code for show Obj()
    Code:
    function showObj(objid)
    {
    	parent.frames['there'].document.getElementById(objid).style.display='block';
    	parent.frames['there'].document.getElementById(objid).style.zindex='5';
    }
    I have found that the alert works on the 0.html <body onload> shown in the schematic above. How can I modify the above code to access the required data in the form controls, that are outside of the iframe?

    (I assume that the modified javascript will have to be added to the 0.html as well as the modified onload code)


    -b

  2. #2
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After the trouble I had last night, I gave up to early.

    Here's the answer:
    Code:
    <script language="JavaScript">function showObj(objid)
    {
    	parent.frames['there'].document.getElementById(objid).style.display='block';
    	parent.frames['there'].document.getElementById(objid).style.zindex='5';
    }</script>
    </head>
    
    <body onload="showObj('Pg'+parent.document.forms['chapage'].elements['pge'].value);">
    Thanks anyway. Hope that this helps someone-someday.

    -b


Bookmarks

Posting Permissions

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