How to count frames with javascript

Posted on 2009-02-10
Last Modified: 2012-05-06
Hi, I work with a tool that uses javascript. One particular form that I'm working with, has several frames, and I need to pass the value of one frame, to another. Problem is, since my company doesn't have access to the "black box" code of the application, and of course, no tutorials are available that would show us the structure of a page, I have to idea how to pass this value. I was hoping of finding out the names of the frames used, I'm using the Form OnAfterLoad event handler. Any ideas?
Question by:horalia
    LVL 15

    Accepted Solution

    I don't really understand the question.  Here's a function that should return frame names within an (x)html frameset.
      function getfnames(){
          var str = '';
          var f = top.frames;
          for(var i = 0; i < f.length; i++){
              str += 'Frame ' + (i + 1) + ', Name: ' + f[i].name + '\n';

    Open in new window


    Author Comment

    I actually wanted to know how to access all the elements in the frames. I already found out that there are three frames. What I need to know now, are the elements that each frame has so I can figure out which one I need to pass. Let me give you a little more explanation... The web page contains different forms, each form has its own events. I want to use a value contained in frame a in frame b. It's a real pain working with propietary software, you have to hack the system in order to make things work...

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This article shows how to read a single webpage's HTML into a string variable, and it also shows how to automate a sequence so you can read and process a list of webpages.  I was tasked with reading and parsing a series of webpages to collect some s…
    In my daily work (mainly using, I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now