Solved

check if frame exists

Posted on 2002-07-12
4
2,907 Views
Last Modified: 2012-08-13
I've to reload another frame:
parent.frames[8].location = "page2.htm";
this scripts is included in all my pages with an .js file

But sometimes there's another frameset and the specific frame does not exists. So the scripts should only work when the frame exists

I tried something like:

if (parent.frames[8].name == 'framename')
     {
     parent.frames[8].location = "page2.htm";
     }

But still get an error when there's no frame 8.
0
Comment
Question by:moswa
  • 3
4 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7148638
var w = window.open("", "framename");
if(w)
{
   alert("frame is present!")
   w.location = "page2.htm"
}
0
 
LVL 1

Author Comment

by:moswa
ID: 7148653
I don't want to use window.open. If there's no frame[8] just don't run the script, not try to create the page.

I had the script working few months ago, but lost the script. Its was something like

if (parent.frames[8].name == 'framename')
    {
    parent.frames[8].location = "page2.htm";
    }

or

if (parent.frames[8]=true)
    {
    parent.frames[8].location = "page2.htm";
    }
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7148724
see above. it does NOT open a window!
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 50 total points
ID: 7148726
if(parent.frames && parent.frames[8] && parent.frames[8].name=="framename")
  parent.frames[8].location="page2.htm";
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…
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…

743 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

12 Experts available now in Live!

Get 1:1 Help Now