if (GetCookie ........

F

F. Clausen

This works in FF but not in IE6:

if (GetCookie("setm") >" ") top.frames['main'].document.location.href
= GetCookie("setm");

But why ?
 
D

David Mark

This works in FF but not in IE6:

if (GetCookie("setm") >" ") top.frames['main'].document.location.href
= GetCookie("setm");

But why ?

What is GetCookie?
 
F

F. Clausen

This works in FF but not in IE6:

if (GetCookie("setm") >" ") top.frames['main'].document.location.href
= GetCookie("setm");

But why ?

What is GetCookie?

Sorry it works, the error was in another script:
else SetCookie("setm"," ");

But I have this other problem:

This is ok offline:
var url = document.location.href.substring(39);

but online I need to change the number because the
the string has not the same length,

so I tryed this:

var url = document.location.href.substring("leisure",8);

I did work yesterday, but for some reason not yet,
is there an error there ?

Or is there another way to retrieve
the document filename like: "some.html"
 
F

F. Clausen

And how does it have a value greater than/less than " " ?????

I guess I could check if the cookie is there, if (!GetCookie ...
But then I need to be able to delete the cookie :)
and I have not found out yet how.
 
S

scripts.contact

Or is there another way to retrieve
the document filename like: "some.html"

location.pathname.slice(location.pathname.lastIndexOf('/')+1)
or
location.pathname.replace(/.*\//,'')
or
location.pathname.replace(/.*\/(.*)$/,'$1')
 
F

F. Clausen

location.pathname.slice(location.pathname.lastIndexOf('/')+1)
or
location.pathname.replace(/.*\//,'')
or
location.pathname.replace(/.*\/(.*)$/,'$1')

I found out this:

lc = location.href.lastIndexOf('/')+1;
url = location.href.substring(lc);

How can I write this in one line ?
 
D

David Mark

I found out this:

lc = location.href.lastIndexOf('/')+1;
url = location.href.substring(lc);

How can I write this in one line ?

It looks like you have answers to this in the text you quoted.
 
E

Evertjan.

scripts.contact wrote on 15 jul 2007 in comp.lang.javascript:
url=location.pathname.slice(location.pathname.lastIndexOf('/')+1)

url=location.pathname.replace(/.*?\//g,'')
 
F

F. Clausen

but I don't know how to use it :)
url=location.pathname.slice(location.pathname.lastIndexOf('/')+1)

I found out and did cancel my message 5 minutes later,
but thanx.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,416
Latest member
LionelQ387

Latest Threads

Top