reload self into frames

They have: 56 posts

Joined: Feb 2000

what i want it to do is set a variable for the href location if the page. then it checks to see if the page is in frames or not .if it is not it puts it in frames. it's not working though. here is the code i have. what did i do wrong?

<script>
var thePage = self.location.href;
if (self == top){
document.write("");
document.write("");
document.write("");
document.write("");
document.write("");
document.write("");
document.write("");
document.write("Your browser does not support frames");
document.write("");
}
</script>

The trouble with doing something right the first time is that nobody appreciates how difficult it was.

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi rageforth,

Long time no see Smiling

I ran your code and it threw the frames where they belonged. So...what's the problem? Or am I missing something?

Vinny

Where the world once stood
the blades of grass cut me still

They have: 56 posts

Joined: Feb 2000

Yes long time no see Smiling I have been doing a lot of Flash and Cold Fusion lately and I just finally got a chance to do more JavaScript stuff. All the JavaScript that I know really helps with my Flash and Cold Fusion work. It's great! Smiling
The problem with me was when the page reloads, the middle frame where the content is suppose to go, it was a blank white page. View the source and all that is in there is the begin and end HTML tags.

The trouble with doing something right the first time is that nobody appreciates how difficult it was.

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Yep I was missing something Smiling

Ok. Instead of placing the document.write within 'thePage', try this:

within the page:

<script language='javascript'>
var thePage = self.location.href;
if (self == top)
{
location.href= "SomePage.html?" + thePage;
}
</script>

Within "somepage.html":

<script>
var thePage = location.search.substring(1);
document.write("");
document.write("");
document.write("");
document.write("");
document.write("");
document.write("");
document.write("Your browser does not support frames");
frames[1].src=thePage
</script>

It may not be the cleanest solution, but it works for me Smiling
Someone else (preferably someone who plays with frames a lot-- I don't) may come by with a better solution.

Where the world once stood
the blades of grass cut me still

They have: 56 posts

Joined: Feb 2000

With a little customizing to it, it worked Smiling

on board.html i put this in the HEAD tags like you said:
<script>
var thePage = self.location.href;
if (self == top){
location.href= "index.html?" + thePage;
}
</script>

on index.html i put this in the HEAD tags:

<script>
var thePage = location.search.substring(1);
document.write("");
document.write("");
if (thePage >= -1){
document.write("");
}
else{
document.write("");
}
document.write("");
document.write("");
document.write("");
document.write("Your browser does not support frames");
frames[1].src=thePage
</script>

it does an if statement. if 'thePage' is undefined, then it does one piece of code. otherwise it does another. seems to work in both browsers too. thanks for the help yet again Vincent Smiling

The trouble with doing something right the first time is that nobody appreciates how difficult it was.

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi rage,

no prob. glad to at least try to help Smiling

Vinny

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.