Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3212652
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:51:37+00:00 2026-05-17T14:51:37+00:00

I have a old fashion page that uses a frameset containing a top frame

  • 0

I have a old fashion page that uses a frameset containing a top frame and bottom frame. The frameset is defined in “index.html” and my code is as follows:

<html>
<head>

<script src="jquery-1.4.2.min.js" type="text/javascript"></script>

<script>

    $(document).ready(function(){

        $('#mainFrame').ready(function() {

            $('#mainFrame a').live('click', function() {
                alert('u click');
                return false;
            }); 

        });

    });

</script>

</head>
<frameset id="main" rows="125,*" cols="*">
<frame src="header.html" name="headerFrame" id="headerFrame" />
<frame src="main.html" name="mainFrame" id="mainFrame"  />
</frameset>
</html>

I would like to be able to intercept links that are clicked on the frame “mainFrame”. I thought I could just add a ready event for it then live bind click events but it doesn’t work. Any ideas?

Note: The files are all on the same domain so this is not an XSS issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T14:51:37+00:00Added an answer on May 17, 2026 at 2:51 pm
    <script>
    $(document).ready(function(){
      $('#mainFrame').ready(function() {
        var f = document.getElementById('mainFrame').contentWindow.document;
        $('a', f).live('click', function() {
          alert('u click');
          return false;
        });
      });
    });
    </script>
    

    You just need to add a context to jQuery statement, to tell it where to look for #mainFrame a

    Oh yeah….you definitely need to make sure that the iframe is loaded. The “live” should take care of that…but I’m working on something now where I had to write a custom ready() plugin for jQuery to make sure my frames were loaded, because I was having trouble with Chrome.

    Chrome and IE seem to jump the gun on with the document.addEventListener(“DOMContentLoaded”… which I believe is what the ready() functions in jQuery use.

    Anyways, just make sure that your iframes get loaded all the way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have old code that uses size_t which IIRC comes from cstring.h. On OS
We have a really old legacy code base that uses globals like they're going
I have old code that uses new Date(dateString) to parse a date string. Compiling
I have only ever dealt with database querys before in the old fashion that
I have a program that uses (and must continue to use) an old sorting
I have a old website that generate its own RSS everytime a new post
I have several old 3.5in floppy disks that I would like to backup. My
Hi i have native ios app And i have old version that not compitible
I have a Rails application that has to co-exist with a very old legacy
I have a fairly simple desktop application that uses a .NET setup project (.msi

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.