A
alain dhaene
Hi,
I get the follow problem.
A page is locate in C:\Directory\files\pag1.php
There I call the function setUrl. (all the functions are located in
C:\Directory\includes
function setUrl()
{
var ckyDatum = new Date;
ckyDatum.setDate(ckyDatum.getDate()+7);
var href = document.location.href;
the_cookie = escape(href);
document.cookie = 'test=' + the_cookie + '; path=/;' ;
alert(document.cookie);
}
This is OK : the alert results in ' test =
C\Directory\files\pag1.php
In a page located in C:\Directory\sub\pag5.php I call the function getUrl
<script language="JavaScript">
getUrl();
</script>
function getUrl()
{
var resultaat;
resultaat = leesUrl('test');
alert(resultaat); //OK
The alert results in
C\Directory\files\pag1.php
document.write ("<a href="+ resultaat + "><img
border='0'src='../afbeeldingen/Algemeen/terugbr.gif'></a>");
!!!!!!!!!!!!!!!!!!//this is not good. I get the follow a href:
C:\Directory\sub\c\Directory\files\pag1.php
}
function leesUrl(cookieName)
{
cookie_array = document.cookie.split ("; ")
for (x=0; x < cookie_array.length; x++)
{
cookieParts_array = cookie_array[x].split("=")
if (cookieParts_array[0] == cookieName)
{
alert (cookieParts_array[1]);
return cookieParts_array[1];
}
}
}
What's wrong?
Alain
I get the follow problem.
A page is locate in C:\Directory\files\pag1.php
There I call the function setUrl. (all the functions are located in
C:\Directory\includes
function setUrl()
{
var ckyDatum = new Date;
ckyDatum.setDate(ckyDatum.getDate()+7);
var href = document.location.href;
the_cookie = escape(href);
document.cookie = 'test=' + the_cookie + '; path=/;' ;
alert(document.cookie);
}
This is OK : the alert results in ' test =
C\Directory\files\pag1.php
In a page located in C:\Directory\sub\pag5.php I call the function getUrl
<script language="JavaScript">
getUrl();
</script>
function getUrl()
{
var resultaat;
resultaat = leesUrl('test');
alert(resultaat); //OK
The alert results in
C\Directory\files\pag1.php
document.write ("<a href="+ resultaat + "><img
border='0'src='../afbeeldingen/Algemeen/terugbr.gif'></a>");
!!!!!!!!!!!!!!!!!!//this is not good. I get the follow a href:
C:\Directory\sub\c\Directory\files\pag1.php
}
function leesUrl(cookieName)
{
cookie_array = document.cookie.split ("; ")
for (x=0; x < cookie_array.length; x++)
{
cookieParts_array = cookie_array[x].split("=")
if (cookieParts_array[0] == cookieName)
{
alert (cookieParts_array[1]);
return cookieParts_array[1];
}
}
}
What's wrong?
Alain