?
Solved

Possible to getElementById with Frames?

Posted on 2006-06-30
4
Medium Priority
?
635 Views
Last Modified: 2006-11-18
Is it possible to some how set a Form Elements propery with the page is it frames...?

cb=document.getElementById('something');
is fine when there is no frames, however it fails to get it when there is frames
so... how can I get an element in frames?

cb=document.frames[0].getElementById('something'); or something?
0
Comment
Question by:wildzero
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Assisted Solution

by:sandylaw
sandylaw earned 100 total points
ID: 17022086
This is an exerpt from http://www.quirksmode.org/ (just so you know why i'm directing you there).  It has great references...this section is (side navigation) Javascript->Frames and windows:

===================================
The three new frames are children of content because the frameset that defines them is in the content frame. So to JavaScript, the page really looks like this:
<DIGRAM SHOWN WITH FRAMES>
The user doesn't see content, but it's still there. You can refer to it in JavaScript or even in an HTML target attribute and it'll work fine.
===================================

I've not done that before, but it appears to be possible.
0
 
LVL 16

Assisted Solution

by:sam85281
sam85281 earned 400 total points
ID: 17022701
cb = top.frames.FRAME_NAME.getElementById('something');

-Sam
0
 
LVL 10

Author Comment

by:wildzero
ID: 17025551
What happens if I don't know the frame name?
0
 
LVL 16

Accepted Solution

by:
sam85281 earned 400 total points
ID: 17025921
You can just look in the index.html, default.aspx, etc page.

It'll look like:
<frame src="blah.html" NAME="FRAME_NAME" .......

You have to know the name of the frame to be able to access it.

-Sam
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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

762 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