View Full Version : onLoad - not loading?
Please HELP! I've been trying to display a page in a frame by passing a variable. For some reason, the script won't load. I even considered that maybe I had mistyped something in the script itself. So I created a different script that does NOTHING EXCEPT show an alert box. That alert box never even shows up.
Where do I put the "onLoad=toFrame()" string? Iv'e tried putting it in every location I can possibly concieve.
After I finally get the script to load, I plan to rename toFrame2 as toFrame.
Thanks.
<html>
<script>function toFrame(){
alert("Hi")
}
</script>
<frameset rows="75,*,25" border="0">
<frame src="top.html" name="top" marginwidth="0" marginheight="0" scrolling="no" noresize>
<frameset cols="200,*,10" border="0">
<frame src="navigation.html" name="navigation" marginwidth="5" marginheight="0" scrolling="auto" noresize>
<script>
function toFrame(){
alert("Why not?")
}</script>
<frame self.onload="toFrame()" name="main" marginwidth="0" marginheight="0" scrolling="auto" noresize>
<frame src="RightSide.html" name="RightSide" marginwidth="0" marginheight="0" scrolling="auto" noresize>
</frameset>
<frame src="bottom.html" name="bottom" marginwidth="0" marginheight="0" scrolling="no" noresize>
<noframes>
<h4> Your Browser Doesn't Support Frames.</h4>
</noframes>
</frameset>
</html>
beetle
10-24-2002, 02:21 AM
self.onload is the scripting equivalent to onload. Since you are attaching the event to the frame with HTML and not scripting, all you need is
<frame onload="toFrame();" name="main" marginwidth="0" marginheight="0" scrolling="auto" noresize>
Ugh!
This is starting to drive me batty. Now it CONSTANTLY re-attempts to load the main page. Thinking that MAYBE it was something in the html file that It's trying to load, I deleted the specified files off the server. I've also attached my html file (saved as a txt).
To see what I mean go the following location:
http://mywebpages.comcast.net/doni49/newindex.html
Be forewarned: start a NEW instance of your browser (OR right-click and "Open in New Window") and go to the URL there--the only way out of the endless loop is to close the browser.
Thanks again the assistance is GREATLY appreciated!
<html>
<head>
<Title>Don Ireland</title>
<baseref "http://mywebpages.comcast.net/doni49/">
</head>
<script language="JavaScript" src="JavaScript/NoRightClick.js"></script>
<script>
function toFrame(){
if(self.location.search){
self.main.location = "http://mywebpages.comcast.net/doni49/" + self.location.search.slice(1)
}
else {
self.main.location = "http://mywebpages.comcast.net/doni49/home.html"
}
}
</script>
<frameset rows="75,*,25" border="0">
<frame src="top.html" name="top" marginwidth="0" marginheight="0" scrolling="no" noresize>
<frameset cols="200,*,10" border="0">
<frame src="navigation.html" name="navigation" marginwidth="5" marginheight="0" scrolling="auto" noresize>
<frame onload="toFrame() " name="main" marginwidth="0" marginheight="0" scrolling="auto" noresize>
<frame src="RightSide.html" name="RightSide" marginwidth="0" marginheight="0" scrolling="auto" noresize>
</frameset>
<frame src="bottom.html" name="bottom" marginwidth="0" marginheight="0" scrolling="no" noresize>
<noframes>
<h4> Your Browser Doesn't Support Frames.</h4>
</noframes>
</frameset>
</html>
beetle
10-24-2002, 04:02 AM
I already know the problem, and the solution..I hope...<script>
var first = true;
function toFrame(){
if (first) {
if(self.location.search){
self.main.location = "http://mywebpages.comcast.net/doni49/" + self.location.search.slice(1)
}
else {
self.main.location = "http://mywebpages.comcast.net/doni49/home.html"
}
first = false;
}
}
</script>
Originally posted by beetle
I already know the problem, and the solution..I hope...<script>
var first = true;
function toFrame(){
if (first) {
if(self.location.search){
self.main.location = "http://mywebpages.comcast.net/doni49/" + self.location.search.slice(1)
}
else {
self.main.location = "http://mywebpages.comcast.net/doni49/home.html"
}
first = false;
}
}
</script>
Thanks for the attempt--still no change. FRUSTRATING:confused: :confused: :confused:
Thinking that I saw where you were going with that, I changed it to the following after I saw that it still wasn't working. The items in red are what I changed. I did this because I've seen cases in other languages where the "true" & "false" constants had been corrupted.
function toFrame(){
var first = 1;
if (first == 1) {
if(self.location.search){
self.main.location = "http://mywebpages.comcast.net/doni49/" + self.location.search.slice(1)
}
else {
self.main.location = "http://mywebpages.comcast.net/doni49/home.html"
}
first = 0;
}
}
beetle
10-24-2002, 04:48 AM
So is it working now?
joh6nn
10-24-2002, 05:19 AM
this is a two part script; there's the part that has to be put in the pages that you want to stay in the frames; that is usually the part, that leads to endless looping. can we see that part of the script as well?
Originally posted by joh6nn
this is a two part script; there's the part that has to be put in the pages that you want to stay in the frames; that is usually the part, that leads to endless looping. can we see that part of the script as well?
Thinking that MAYBE that was causing the loop, I deleted the file off the server. (The destination file that is.)
However when the file is there, this is the script that's in it.
<script>
//if not in frames
if (parent.frames.length==0)
//CHANGE "index.htm" to the URL of your main frame page
window.location.replace("index.html?home.html")
</script>
Last night's test and message post were done at home. Now I'm at work trying to fix it on my lunch break. Here at work, the script seems to not even run at all. It's doing the SAME thing it did when I had the self.onload="toFrame()" in my frame definition.
However, I've TRIPLE checked and it says onload="toFrame()" Which is the same thing it said when I went to bed last night.
Just now, I even renamed the toFrame function (as toFrame2) and put this script back in it's place
function toFrame(){
alert("Why not?");
}
This is from my frame definition:
onload="toFrame()"
Even with doing this, I never get an alert box. I've tried this with AND WITHOUT the ";" after the alert.
This keeps getting stranger and stranger.:confused: :confused: :confused:
Originally posted by beetle
So is it working now?
When I last tested from my home PC, it was stuck in an endless loop. When I try it from work, the script doesn't seem to be even running.:(
I even thought that maybe my work PC has java disabled. That's not it because the navigation page (shows up in one of the other frames) has a "Java Clock" in it and it's working correctly here AND at home.
joh6nn
10-24-2002, 07:34 PM
after i installed SP1 on IE6, the onload event stopped firing. i've yet to hear of anyone else experiencing the same problem, but i also haven't asked around. that could be the problem you're having at work.
you noted that you deleted the file from server. i assume that the looping continued when you did that.
the only thing i can think of now, is that other scripts on the pages may be interfering. can we see the rest of the code, for both the frameset, and framed pages?
Originally posted by joh6nn
after i installed SP1 on IE6, the onload event stopped firing. i've yet to hear of anyone else experiencing the same problem, but i also haven't asked around. that could be the problem you're having at work.
you noted that you deleted the file from server. i assume that the looping continued when you did that.
the only thing i can think of now, is that other scripts on the pages may be interfering. can we see the rest of the code, for both the frameset, and framed pages?
Yes, the problem continues even after deleting the destination file. Your suggestion of IE6 not using the onLoad item seems to be valid--when I got home, I tested it again and the endless loop was still there.
Update:
In an attempt to NOT USE the onLoad attribute, created a new page and tried using the information provided here (http://tech.irt.org/articles/js013/index.htm) to create the frames via document.write. I was able to get that method to work without errors.
Thanks EVERYONE for the assitance.:thumbsup: :thumbsup:
Ahhh-relief! :D
beetle
10-25-2002, 02:08 AM
Oh....that's what you needed? I wish I knew...I already have a script (http://www.peterbailey.net/js/superframes.js) that does that :rolleyes:
Que surrah surrah :D
Originally posted by beetle
Oh....that's what you needed? I wish I knew...I already have a script (http://www.peterbailey.net/js/superframes.js) that does that :rolleyes:
Que surrah surrah :D
Oh well--I guess I must not have explained it clearly enough. Judging from the answers I was getting, I thought everyone understood the situation.
Thanks again for the attempt though EVERYONE!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.