...

View Full Version : Location Syntax



peterinwa
02-24-2003, 11:48 PM
I tried my books and searching this site and gave up so I have to ask this really novice question.

I had a graphic on my page as an href link to another page, but before jumping to the new page I want to write a cookie. So I changed the href to call a function, but can't figure out the syntax to then jump to the new page.

function WriteCookieGoToNewPage(){
saveCookie... this line works fine
location.'pageName.html' target='_top'}

I get the error messages Expected Identifier and Object Expected.

Thanks!

Graeme Hackston
02-25-2003, 12:58 AM
Try location.href

peterinwa
02-25-2003, 01:04 AM
If you mean:

location.href.'pageName.html'

instead of:

location.'pageName.html'

I still got the same errors.

Graeme Hackston
02-25-2003, 01:10 AM
location.href = 'pageName.html'

It might need to be like this, I'm not sure

window.location.href = 'pageName.html'

peterinwa
02-25-2003, 01:54 AM
It's working now, thanks:

location.href='pageName.html';

though it didn't like target='_top' added on to the end.

Graeme Hackston
02-25-2003, 02:14 AM
Glad it works, this should help

http://www.devguru.com/Technologies/ecmascript/quickref/javascript_index.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum