Forum Moderators: open
I am newbie to both html and Java as well as to this site. I hope this is the correct forum for my question and sorry for a long description of the issue. My question is:
How can I identify the frame numbers in a complex frame page in order to use the parent[x].location command in a java script to replace the contents of two frames, and changing source directory, using a simple form?
I am using a script that acts as a simple password/login feature on a site. The purpose of the script is to change a directory using a password in a form as well as changing the contents of a page. The password entered is the name of the immediate sub directory. My ultimate goal is to alter the functionality of this script to
a) replace/change the html pages in two frames simultaneously
b) Change the source directory of the html pages to be loaded
The script I am using is as follows:
function a001()
{
if (document.a.b.value != "")
{
parent[x].location=escape(document.a.b.value.toLowerCase()) + "/index.html";
document.a.b.value = "";
}
}
The frame structure is fairly complex and I am having difficulties in understanding how to identify the number of the frame to replace the [x] with? That is assuming the script has the potential to perform the tasks I would like it to perform.
The form is located in frame page 04 (se below) in the content_page_frame and I would like to change the menu_top_frame and content_page_frame in this frame page to menu_top_frame_2 and content_page_frame_2 located in an immediate sub directory.
The site I have constructed is in html the frame hierarchy is as follows:
Frame page 01 - three vertical frames page to center the website horizontally, i.e. cols: *,900,*. frames are left_margin, main_page and right_margin
Frame page 02 - The main_page frame of frame page 01 contains frame page 02 which is a similar frames page as the above page, but this time to center the website vertically. i.e. row: *,560,*. Frames are top_margin, main_content_page and bottom_margin.
The main_content_page of frame page 02 is containing the website which is also constructed with a number of frames
Frame page 3 - The main_content_page in frame page 02 contains a split horizontally framepage were the top frame contains a heading to the site. The bottom frame contains frames page 04
Frame Page 04 is yet another frames page which is fixed menu_top_frame, a center content_page_frame and relative bottom_frame (contains a fixed graphic).
Again, the issue for me is to identify the number of the menu_top_frame and content_page_frame in frames page 04 in order to use those numbers in the parent[x].location command to replace those two frames to menu_top_frame_2 and content_page_frame_2 located in an immediate sub directory.
Thank you for taking the time to help with this question!
Regards
/Bathojden
I am using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
I assume you are sourcing iframes from a domain different from that of containing page, there are security restricting limiting what is possible.
Search for "Cross-Domain Communication with IFrames" for starters. The short answer is to name the frames and use parent.frames["name"].src, above reference explains in detail.