Solved

check if frame exists

Posted on 2002-07-12
4
2,947 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
[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
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

In my daily work (mainly using ASP.net), 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 …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

738 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