...

View Full Version : location.href syntax problem



peterinwa
02-25-2003, 09:31 PM
This works fine:

// Function to save cookie and jump to note page
function noteJump(){
saveCookie1y("noteCookie",0,X1y);
location.href='note.html';
}

But I'm jumping from a frames page to an non-frames page and it's creating a problem. Here's what I need to do but the syntax is illegal. Just the last line is different:

// Function to save cookie and jump to note page
function noteJump(){
saveCookie1y("noteCookie",0,X1y);
location.href='note.html' target='_top';
}

I also tried:

location.href('note.html' target='_top');

My !#*&% books are always written for people that have programming training. I just wish they gave examples of actual coding because it's always a ; or : or something like that that hangs me up.

Thanks!

P.S.

Perhaps there is another way to do this? Click on a link and have a cookie written before jumping to the link?

x_goose_x
02-25-2003, 09:40 PM
try:

top._top.location.replace("nextsite.htm")

peterinwa
02-25-2003, 09:50 PM
I didn't get an error message when the page came up, but when I clicked on the link and it called the function I got:

Error: 'top._top.location' is null or not an object

tempest1
02-25-2003, 10:23 PM
just call the frame name like this, not sure what it is...


targetframename.location.href='';

dagaffer
02-25-2003, 10:31 PM
parent._top.location.href="note.html"
should work:thumbsup:

peterinwa
02-25-2003, 10:33 PM
I tried:

targetframename.location.href='faqs_fast.html';

When the function is called I get the error message:

'targetframename' is undefined

peterinwa
02-25-2003, 10:47 PM
I tried:

parent._top.location.href="note.html";

When the function was called I got the error message:

Error: 'parent._top.location' is null or not an object

dagaffer
02-25-2003, 10:53 PM
ahh, re-reading question:
top.location.href="note.html";
should work....

peterinwa
02-25-2003, 11:09 PM
Thanks dagaffer!

after

parent._top.location.href='note.html';

failed I got an idea and tried

parent.location.href='note.html';

and it worked fine. But it was just a guess and I'm not sure of it so I'll go with your last recommendation which also works fine:

top.location.href='note.html';

I just can't get this stuff out of books!

ConfusedOfLife
02-26-2003, 12:37 AM
Frames could be nested in each other. That means using a framed page inside another framed page and going as deep as you want! So, by saying top. you mean going back to the very first page ( the grand grand father! ). But by using parent you just go one level back. Hope that it helped!

peterinwa
02-26-2003, 12:41 AM
I suspected that though I have never gone that deep. But that's why I chose to use top.

Thanks for the post to help others that follow... should there EVER be anyone that codes as I do! :o



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum