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
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Loading frames and Javascript together

    <HTML>
    <HEAD>
    <SCRIPT>
    function closeIt()
    {
    event.returnValue = "Testing";
    }
    </SCRIPT>

    <FRAMESET ROWS="50%,50%">
    <FRAME NAME="One" SRC="one.php">
    <FRAME NAME="Two" SRC="two.php">
    </FRAMESET>
    </HEAD>

    <BODY onbeforeunload="closeIt()">
    </BODY>
    </HTML>

    If I put the codes as above, the function onbeforeunload="closeIt()" does not work at all but I can managed to see the frames. If I put the function onbeforeunload="closeIt()" before the frameset, I cannot view the frames at all and javascript function is working. How can I solve this so that I can view the frames and want the javascript function to work as well?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    thats not even a valid frameset, however, the frameset will override the body tags because those truly should be seen by a user who has noframes, hence making your script nonfunctional, y dont u just put it on one of your frameset pages?

  • #3
    Super Moderator sage45's Avatar
    Join Date
    May 2002
    Posts
    1,063
    Thanks
    0
    Thanked 14 Times in 14 Posts
    Code:
    <HTML>
    <HEAD>
    <SCRIPT>
    function closeIt()
    {
    event.returnValue = "Testing";
    }
    closeIt();
    </SCRIPT>
    
    <FRAMESET ROWS="50%,50%">
    <FRAME NAME="One" SRC="one.php">
    <FRAME NAME="Two" SRC="two.php">
    </FRAMESET>
    </HEAD>
    
    <BODY> 
    </BODY>
    </HTML>
    Could try this way...

    -sage-
    HTML & CSS Forum Moderator

    "If you don't know what you think you know, then what do you know."
    R.I.P. Derrick Thomas #58
    1/1/1967 - 2/8/2000


  •  

    Posting Permissions

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