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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problems with onload/onunload within frame

    I have the following snippet which is causing grief:
    <script>
    window.onunload=Breadcrumb('');
    //window.onbeforeunload=Breadcrumb('');
    window.onload=Breadcrumb('text');
    </script>

    The script is inside a url loaded into an iframe.
    Basically, I am trying to write insert text into a <div> in the parent window when the page loads and remove it when it unloads.
    The code inserts the text correctly as the pages loads, but does not remove it on unload. However, if I switch the events round, the text is written and then immediately overwritten by the onunload.
    I have tried addressing the object as 'this', the document, the window. No good.
    Any help would be much appreciated.

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Code:
    window.onload = function(){ Breadcrumb('text'); }
    
    window.onunload = function(){ Breadcrumb(''); }


  •  

    Tags for this Thread

    Posting Permissions

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