/    Sign up×
Community /Pin to ProfileBookmark

Cannot open page in frame – within function

Hi all,

I know most of you are going to scold me regarding using frames, either way, this is my problem:

At some point during a function on my page I have this if statement:

if(!found){ //if the search term is not found in an array
parent.bottom.location.href = “blank.htm”
}

Using that if statement, it for some reason does not change the location of that frame. However, if I do this:

if(!found){
alert(“whatever”)
parent.bottom.location.href=”blank.htm”
}

Then, it will show the alert and upon clicking ok on the alert, the frame’s location will change to the page I wanted it to.

Is there a specific reason as to why this is happening? What is the alert() triggering that isnt being triggered with just the parent.bottom.location.href=”blank.htm” alone??

I appreciate any help in advance,
Thank you.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@7studNov 14.2004 — Hi,

It may have something to do with the page loading. Depending on when that function gets executed, the page might not be done loading, so maybe the alert() stalls the execution long enough, so that when exection continues the following statement can execute.
Copy linkTweet thisAlerts:
@senshiNov 14.2004 — [i]Originally posted by ai3rules [/i]

[B]Hi all,



I know most of you are going to scold me regarding using frames, either way, this is my problem:



At some point during a function on my page I have this if statement:



[/B]
[/QUOTE]


Theirs nothing wrong with using frames, problem is that people who spout off about not using them dont understand how to use them. Frames actually help speed up your website delivery.

For eample, I would prefer several small pages that load up quick rather than to wait for one page formatted with lots of DIV's to emulate a frames site.

When you start to use and fully understand frames, you begin to see just how easy they are to use and how much better thay make your site, for one, you dont have to keep loading all the same content, images, menus, a simple frame split will allow you to call one page at a time or a new frameset, depends on what your doing.

So when people say you shouldnt use frames, dont listem as they are talking out of their asses.
Copy linkTweet thisAlerts:
@Paul_JrNov 14.2004 — [i]Originally posted by senshi [/i]

[B]Theirs nothing wrong with using frames, problem is that people who spout off about not using them dont understand how to use them. Frames actually help speed up your website delivery.[/b][/quote]

Yup, and they also drive away your visitors and SE bots. Have you tried bookmarking a framed page? Yeah, it's really, really hard, isn't it?

[i]Originally posted by senshi [/i]

[B]For eample, I would prefer several small pages that load up quick rather than to wait for one page formatted with lots of DIV's to emulate a frames site.[/b][/quote]

If you are coding valid, sematic HTML and formatting with CSS, you can have as many frames as you want, and the page will still be larger and still load slower than a CSS-based site.

[i]Originally posted by senshi [/i]

[B]When you start to use and fully understand frames, you begin to see just how easy they are to use and how much better thay make your site, for one, you dont have to keep loading all the same content, images, menus, a simple frame split will allow you to call one page at a time or a new frameset, depends on what your doing.[/b][/quote]

As long as you code valid, sematic HTML and use CSS for formatting, then having the whole page reload is a non-issue.

[i]Originally posted by senshi [/i]

[B]So when people say you shouldnt use frames, dont listem as they are talking out of their asses. [/B][/QUOTE]

Yeah, that's right, we're talking out of our asses. That's why you rarely see professional sites in frames. :rolleyes:
Copy linkTweet thisAlerts:
@ai3rulesauthorNov 14.2004 — 7stud,

That function is executed using a button after the page is completely loaded. So I don't think that's the problem.
Copy linkTweet thisAlerts:
@Warren86Nov 14.2004 — Try not using top and bottom for the frame names and instead use, isTop, isBottom. And instead of the shortcut !found use the complete code. I tried it this way:

<HTML>

<frameset rows="80,*" frameborder="yes" border="1" framespacing="0" >

<frame name="isTop" scrolling="yes" src="First.html" >

<frame name="isBottom" scrolling="yes" src="Second.html">

</frameset>

</HTML>

---------- Second.html --------------

<HTML>

<Head>

<Script Language=JavaScript>

function checkResult(isFound){

if (isFound != true){parent.frames['isBottom'].location = "blank.html"}
}

</Script>

</Head>

<BODY>

<center>

<input type=button value='Found' onclick="checkResult(true)"><br><br>

<input type=button value='Not Found' onclick="checkResult(false)">

</center>

</BODY>

</HTML>
Copy linkTweet thisAlerts:
@senshiNov 14.2004 — [i]Originally posted by Paul Jr [/i]

[B]Yup, and they also drive away your visitors and SE bots. Have you tried bookmarking a framed page? Yeah, it's really, really hard, isn't it?





If you are coding valid, sematic HTML and formatting with CSS, you can have as many frames as you want, and the page will still be larger and still load slower than a CSS-based site.





As long as you code valid, sematic HTML and use CSS for formatting, then having the whole page reload is a non-issue.





Yeah, that's right, we're talking out of our asses. That's why you rarely see professional sites in frames. :rolleyes: [/B]
[/QUOTE]



See what I mean.

Yes I see plenty of website that USE frames rather than CSS for the very reason I have explained previously.

Bandwidth cost money, CSS eats loads of bandwidth, Once a framset has loaded, you only need to chjange one page that needs changing and not the whole CSS page as in your case.

When you actually see the major difference and appreciate the other considerationss you will see that allot of websites favour frameset over CSS for the simple fact of bandwidth usage.
×

Success!

Help @ai3rules spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...