How to count frames with javascript

Posted on 2009-02-10
Medium Priority
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

mr_egyptian earned 2000 total points
ID: 23608042
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

ID: 23615061
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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…
Suggested Courses

850 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