Closed Thread Icon

Topic awaiting preservation: onLoad event Help Pages that link to <a href="https://ozoneasylum.com/backlink?for=8419" title="Pages that link to Topic awaiting preservation: onLoad event Help" rel="nofollow" >Topic awaiting preservation: onLoad event Help\

 
Author Thread
Nussky
Obsessive-Compulsive (I) Inmate

From: Lake George
Insane since: Dec 2002

posted posted 12-03-2002 18:36

Looking for the answer. It's been sometime since I did javascripting and don't have my notepads available to me that I stored what info I learned.

Anyhow, I am looking for a simple and sweet one line script that activates onLoad

basically I use frames on a website. and on occassion search engines or other linking URLs bring up only the main frame and not my navigational frame. I'm looking to put a script on the main frame page that will load up the page that contains both pages everytime that mainpage is loaded

something like this nav.html, main.html, index.html

when main.html is loaded it will overwrite the parent window to load index.html so thus everytime just the main page is loaded the event will load both the main frame and the nav frame.. Please if you can help respond with something I can cut and paste

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 12-03-2002 18:48

hmm a reverse frame buster

onload= "if(top.location.href == self.location.href) location.href = 'mainpage.html')"

that should work.



.:[ Never resist a perfect moment ]:.

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 12-03-2002 19:20

Nussky: Welcome. See this FAQ:

How do I stop direct links from breaking my frame site?

as you are new you might also want to have a look at:

Hi I'm new here what do I need to know?

___________________
Emps

FAQs: Emperor

Nussky
Obsessive-Compulsive (I) Inmate

From: Lake George
Insane since: Dec 2002

posted posted 12-03-2002 19:25

Thank you for that bit, but I guess I worded the question wrong.
and this may entail more than one line of code.

I have two solutions that I need help with

Index.html- sets frames of Main, and Nav.

When just the Main page loads, I wanted the browser to check for the nav frame if that frame is not there, a line of code would automatically load the index.html in the parent frame. If the frame is there is won't load anything

2nd possible solution is to set a link on the main page that will load the index. html into the parent window. I'm haveing problems between HTML and Javascript.

Please help I am grateful for whatever help I get

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 12-03-2002 19:57

The code I gave you should work if put in the main frame and the nav frame pages. here's a complete form (cleaned a bit after looking at emps link)

onload= "if(top == self) location.href = 'index.html')"

What it does is that main and nav should not be the "top" page. so if they are alone in a window it redirects to the frameset.




.:[ Never resist a perfect moment ]:.

Nussky
Obsessive-Compulsive (I) Inmate

From: Lake George
Insane since: Dec 2002

posted posted 12-03-2002 20:33

Sorry I am not too versed in scripting

Do I need to add anything else.

I put that line of code in the Body tag I believe

I am helping a friend with his web site.

Possibly you could look at it
http://www.northlandgardens.com

the problem is that first page.. the main page in the larger section is where I want to place the anti-frame buster

Thanks

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 12-03-2002 20:53

Yep - everything should be fine if you just put that line into the <body> tag, like

<body TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#9C5EA2" VLINK="#551A8B" ALINK="#FF0000" BACKGROUND="../images/back.jpg" onload="if(top == self) location.href = 'index.html')">

Nussky
Obsessive-Compulsive (I) Inmate

From: Lake George
Insane since: Dec 2002

posted posted 12-03-2002 22:24

Thanks for the Help but I did that exactly, and no results

I remeber writing a code 5 yrs ago when i was learning javascript and HTML, it was something like

onLoad="index.html"document.parent.href I'm sure this is wrong but I need to call the onLoad event to load a new web page if it's not the top and then load the new page in the same browser page or parent window

If anyone could inform me to make a temp fix. of a button or Hyperlink that will load up a new page in the parent window, so inotherwords I want to put a URL link on the main page to load up the nav frame, but not have it so web morons, like myslef can't hit the link again and have frame duplication.

Thanks Guys Danke

Rooster
Bipolar (III) Inmate

From: the uterus
Insane since: Nov 2002

posted posted 12-03-2002 23:29

Nussky:

Erase the extra ?)? character at the end of the of code and replace it with a semicolon, it will then work just perfectly....


i.e.
onload="if(top == self) location.href = 'index.html')"
----------------------------------------------------------^

To this...

onload="if(top == self) location.href = 'index.html';"


Typos are inevitable. Try to learn ~why~ the piece of code works instead of just doing a copy/paste, it will help much more in the long run.


..
~Existence is a mere pattern.~

[This message has been edited by Rooster (edited 12-03-2002).]

Hugh
Paranoid (IV) Inmate

From: Dublin, Ireland
Insane since: Jul 2000

posted posted 12-04-2002 19:59

**main.htm**

var loaded=true;

**nav.htm**

if(parent.mainframe.loaded) alert("main loaded"); // mainframe is the name of the frame set in index.html


Is this what your even looking for ?

Wakeupandfly
Neurotic (0) Inmate
Newly admitted

From: Devon, England
Insane since: Mar 2003

posted posted 03-30-2003 22:08

how can i have two onload events on the same page - i also have a java clock running and would like to put the frame check in aswell

Tom

« BackwardsOnwards »

Show Forum Drop Down Menu