473,412 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Cookies - help needed !

Hi,

I have the following script (javascript in html document):

<html>

<head>
<meta http-equiv="content-type"
content="text/html;charset=ISO-8859-1">
<title>Standort Speichern</title>
<link rel="stylesheet" type="text/css"
href="../../../stylesheets/styles.css">

<script language="javascript">

// 0=icon, 1=menue, 2=kopf, 3=task, 4=text, 5=bild, 6=navigation
// benötigt werden zum save nur die Frames 0, 2, 4, 5, 6

URL0 = top.window.opener.parent.frames[0].location.href;
// ist der Inhalt des Icon-Frames
URL1 = top.window.opener.parent.frames[2].location.href;
// ist der Inhalt des Kopf-Frames

URL2 = top.window.opener.parent.frames[4].location.href;
// ist der Inhalt des Text-Frames

URL3 = URL2.substring(0,URL2.length-5) + "b.htm"
// generiert aus dem eineindeutigen Text-Frame das dazugehörige
Bildframe, damit kann das Problem mit den
// verschiedenen Inhalten im Bildframe (b.htm, g.htm, gx.htm)
umschifft werden

URL4 = top.window.opener.parent.frames[6].location.href;
// ist der Inhalt des Navigation-Frames

function setCookie(CookieName, URL0, URL1, URL2, URL3, URL4, expires)
{
document.cookie = escape(CookieName) + "="
+ escape(CookieName) + "URL0$" + escape(URL0) + "&"
+ escape(CookieName) + "URL1$" + escape(URL1) + "&"
+ escape(CookieName) + "URL2$" + escape(URL2) + "&"
+ escape(CookieName) + "URL3$" + escape(URL3) + "&"
+ escape(CookieName) + "URL4$" + escape(URL4) + "&"
+ ((expires == null) ? "" : ("; expires=" +
expires.toGMTString()));
}

function save(UserName)
{
var today = new Date();
var expires = new Date();
expires.setTime(today.getTime() + 1000*60*60*24*365);
// setzt das Verfallsdatum des Cookies auf heute in einem Jahr
(ms*sec*min*h*d), da sonst das Cookie
// bei Schliessen des Browsers automatisch gelöscht wird
if (UserName != "")
{
CookieName = UserName;
setCookie(CookieName, URL0, URL1, URL2, URL3, URL4, expires);
}
}

</script>

</head>

<body class="basic">

<div align="center">
<h3>Standort speichern</h3>
</div>
<br>

<p>Bitte geben Sie im folgenden Textfeld den <strong>Namen des
Standorts</strong> ein unter dem Sie Ihren Lernstand speichern
wollen.</p>
<p>Nach dem Klicken auf die Schaltfl‰che
&quot;<strong>Speichern</strong>&quot;wird Ihr aktueller Standort
unter dem gew&auml;hlten Namen gespeichert.</p>
<br>
<form onSubmit="return false">
<center>
<div align="center">
<p>
<input TYPE="text" NAME="username" SIZE="20">
<input TYPE="button" style="font-family:Arial,
Helvetica;font-size:12px;font-weight:bold;background-color:#c2c2c2;color:
#000080"
value="Speichern"
onClick="javascript:save(this.form.username.value) ;window.close();">
</p>
</div>
</center>
</form>
<br><br><br>

<form NAME="Schaltfl&auml;che OK">
<div align="center">
<input type="button" style="font-family:Arial,Helvetica;
font-size:12px;font-weight:bold;background-color: #c2c2c2;color:
#000080"
name="Schaltfl&auml;che OK" onclick="window.close();"
value="Fenster schliessen">
</div>
</form>

</body>
</html>

What I want to do: save the actual position of a user in this
(learning) program. The screen is built of 7 frames (complex learning
context, needs 7 frames...) of which the url of 5 frames should be
saved in order to return to the actual posistion in the program later.
The script works on:
http://www.zahnpasten.hcbe.ch/home/i...e/homepage.htm but
not on my side - HELP !!!!

ps: I am very unexperienced in programming

THANKS FOR ANY HELP
Jul 20 '05 #1
1 2920
ma**********@mac.com (martingerber) wrote in message news:<bb**************************@posting.google. com>...
Hi,

I have the following script (javascript in html document):

<html>

<head>
<meta http-equiv="content-type"
content="text/html;charset=ISO-8859-1">
<title>Standort Speichern</title>
<link rel="stylesheet" type="text/css"
href="../../../stylesheets/styles.css">

<script language="javascript">

// 0=icon, 1=menue, 2=kopf, 3=task, 4=text, 5=bild, 6=navigation
// benötigt werden zum save nur die Frames 0, 2, 4, 5, 6

URL0 = top.window.opener.parent.frames[0].location.href;
// ist der Inhalt des Icon-Frames
URL1 = top.window.opener.parent.frames[2].location.href;
// ist der Inhalt des Kopf-Frames

URL2 = top.window.opener.parent.frames[4].location.href;
// ist der Inhalt des Text-Frames

URL3 = URL2.substring(0,URL2.length-5) + "b.htm"
// generiert aus dem eineindeutigen Text-Frame das dazugehörige
Bildframe, damit kann das Problem mit den
// verschiedenen Inhalten im Bildframe (b.htm, g.htm, gx.htm)
umschifft werden

URL4 = top.window.opener.parent.frames[6].location.href;
// ist der Inhalt des Navigation-Frames

function setCookie(CookieName, URL0, URL1, URL2, URL3, URL4, expires)
{
document.cookie = escape(CookieName) + "="
+ escape(CookieName) + "URL0$" + escape(URL0) + "&"
+ escape(CookieName) + "URL1$" + escape(URL1) + "&"
+ escape(CookieName) + "URL2$" + escape(URL2) + "&"
+ escape(CookieName) + "URL3$" + escape(URL3) + "&"
+ escape(CookieName) + "URL4$" + escape(URL4) + "&"
+ ((expires == null) ? "" : ("; expires=" +
expires.toGMTString()));
}

function save(UserName)
{
var today = new Date();
var expires = new Date();
expires.setTime(today.getTime() + 1000*60*60*24*365);
// setzt das Verfallsdatum des Cookies auf heute in einem Jahr
(ms*sec*min*h*d), da sonst das Cookie
// bei Schliessen des Browsers automatisch gelöscht wird
if (UserName != "")
{
CookieName = UserName;
setCookie(CookieName, URL0, URL1, URL2, URL3, URL4, expires);
}
}

</script>

</head>

<body class="basic">

<div align="center">
<h3>Standort speichern</h3>
</div>
<br>

<p>Bitte geben Sie im folgenden Textfeld den <strong>Namen des
Standorts</strong> ein unter dem Sie Ihren Lernstand speichern
wollen.</p>
<p>Nach dem Klicken auf die Schaltfl?che
&quot;<strong>Speichern</strong>&quot;wird Ihr aktueller Standort
unter dem gew&auml;hlten Namen gespeichert.</p>
<br>
<form onSubmit="return false">
<center>
<div align="center">
<p>
<input TYPE="text" NAME="username" SIZE="20">
<input TYPE="button" style="font-family:Arial,
Helvetica;font-size:12px;font-weight:bold;background-color:#c2c2c2;color:
#000080"
value="Speichern"
onClick="javascript:save(this.form.username.value) ;window.close();">
</p>
</div>
</center>
</form>
<br><br><br>

<form NAME="Schaltfl&auml;che OK">
<div align="center">
<input type="button" style="font-family:Arial,Helvetica;
font-size:12px;font-weight:bold;background-color: #c2c2c2;color:
#000080"
name="Schaltfl&auml;che OK" onclick="window.close();"
value="Fenster schliessen">
</div>
</form>

</body>
</html>

What I want to do: save the actual position of a user in this
(learning) program. The screen is built of 7 frames (complex learning
context, needs 7 frames...) of which the url of 5 frames should be
saved in order to return to the actual posistion in the program later.
The script works on:
http://www.zahnpasten.hcbe.ch/home/i...e/homepage.htm but
not on my side - HELP !!!!

ps: I am very unexperienced in programming

THANKS FOR ANY HELP


The script to load the content of the frames is:

<html>

<head>
<meta http-equiv="content-type"
content="text/html;charset=ISO-8859-1">

<title>Gespeicherten Standort laden</title>
<link rel="stylesheet" type="text/css"
href="../../../stylesheets/styles.css">
<script language="javascript">
function getCookie(CookieName, Variable)
{
search = escape(CookieName) + Variable;
if (document.cookie.length <= 0)
{
error = 2;
}
else
{
offset = document.cookie.indexOf(search);
if (offset == -1)
{
error = 1;
}
else
{
error = 0;
offset += search.length;
end = document.cookie.indexOf("&", offset);
if (end == -1) end = document.cookie.length-1;
return unescape(document.cookie.substring(offset, end));
}
}
}

function load(UserName)
{
if (UserName == "")
{
parent.window.close();
}
else
{
CookieName = UserName;

_URL0 = getCookie(CookieName, 'URL0$');
_URL1 = getCookie(CookieName, 'URL1$');
_URL2 = getCookie(CookieName, 'URL2$');
_URL3 = getCookie(CookieName, 'URL3$');
_URL4 = getCookie(CookieName, 'URL4$');
if (error == 0)
{
top.window.opener.parent.frames[0].location.href = _URL0;
top.window.opener.parent.frames[2].location.href = _URL1;
top.window.opener.parent.frames[4].location.href = _URL2;
top.window.opener.parent.frames[5].location.href = _URL3;
top.window.opener.parent.frames[6].location.href = _URL4;
// vergleiche die Framezuteilung: URLO in frame 0=icon, URL1
in frame 2=kopf
// URL2 in frame 4=text, URL3 (generiert aus URL2) in
frame5=bild, URL4
parent.window.close();
}
if (error != 0)
{
parent.document.writeln ( "<html><head><title>Error: Eintrag
nicht gefunden!</title></head>" )
parent.document.writeln ( "<body><body BGCOLOR=\"#D6E0DB\"
text=\"#000000\" link=\"#000080\" vlink=\"#000080\">" )
parent.document.writeln ( "<table border=\"0\" width=\"100%\"
bgcolor=\"#A4B0AB\"><tr><td width=\"100%\"><p align=\"center\"><font
color=\"#000000\" face=\"Arial\"><big><strong>Oops!</strong></big></font></td></tr></table>"
)
parent.document.writeln ( "<p>&nbsp;</p><p>&nbsp;</p><p
align=\"center\"><font size=\"3\" color=\"#000000\"
face=\"Arial\">Unter diesem Namen ist kein Standort
gespeichert!</font></p>" )
parent.document.writeln (
"<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><div
align=\"center\"><center><table BORDER=\"0\" CELLPADDING=\"4\"
CELLSPACING=\"0\" bgcolor=\"#A4B0AB\" width=\"100%\"><tr><td
align=\"center\">
<a href=\"javascript:window.history.back();\"><p><fon t
face=\"Arial\"> <p align=\"center\">zur&uuml;ck</font></p></a></td></tr></table></center></div>"
)
parent.document.writeln ( "</body></html>" )
parent.document.close()
}
}
}
</script>
</head>

<body class="basic">

<div align="center">
<h3>Gespeicherten Standort laden</h3>
</div>
<br>
<p>Bitte geben Sie im folgenden Textfeld den <strong>Namen des
Standorts</strong> ein unter dem Sie Ihren Lernstand abgespeichert
haben.</p>
<p>Nach dem Klicken auf die Schaltfl‰che
&quot;<strong>Laden</strong>&quot;wird Ihr gespeicherter Standort
geladen und automatisch im Browser-Fenster angezeigt.</p>
<p>t<a href="../../../jscript/history.js">estli</a>nk</p>
<br>
<form onSubmit="return false">
<div align="center">
<center>
<p>
<input TYPE="text" NAME="username" SIZE="25">
<input TYPE="button" style="font-family:Arial, Helvetica;
font-size:12px;
font-weight:bold;
background-color: #c2c2c2;
color: #000080"
value="Laden" onClick="load(this.form.username.value);"></p>
</center>
</div>
</form>
<br><br><br>
<form NAME="Schaltfl‰che OK">
<div align="center">
<input type="button" style="
font-family:Arial,Helvetica;
font-size:12px;
font-weight:bold;
background-color: #c2c2c2;
color: #000080"
name="Schaltfl‰che OK" onclick="window.close();" value="Fenster
schliessen"></font></div>
</form>
</body>
</html>

I tried everything and would be very grateful for help !!
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Hal Vaughan | last post by:
I'm trying to access a site with data that needs to be paged through, one page at a time. It won't allow back buttons and you have to use the menu links to get through. In other words, it is run...
2
by: Amit D.Shinde | last post by:
Hello Experts.. I need some help regarding cookies and session objects and also global.asa file I am creating one cookie when a user logs in on my website. The cookie stores the login name of...
9
by: | last post by:
Is it possible for a user to enable permanent cookies but disable session cookies.....this seems like a contradition yet this is what I appear to be reading in online articles?
3
by: Raghu Raman | last post by:
Hi, I want to store a cookie peemanently for 2 days.From msdn article, i have coded like this.It is working when i run my application .But if i close my browser and restart my application , i...
1
by: Randall Parker | last post by:
Some basic security questions: 1) Is there any difference in the sort of encryption keys needed for encrypted cookies versus for https connections? 2) Does one need encrypted cookies for...
6
by: jojowebdev | last post by:
Do javascript cookies REALLY have to be this hard? function setCookie( name, value, expires, path, domain, secure ) { var today = new Date(); today.setTime( today.getTime() ); if ( expires ) {...
7
by: André | last post by:
Hi, I need several cookies depending of an variable (x), so i defined a HttpCookie() as an array. My problems: 1)I get the error: Object reference not set to an instance of an object. 2)My...
24
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How can I see in javascript if a web browser accepts cookies?...
8
by: Chuck Anderson | last post by:
I've instituted a sessions based scheme on my web site to combat hot linking to my images. When someone requests a page at my site, I set a session variable. I then use htaccess to redirect *all*...
10
by: _Who | last post by:
Given Request.Cookies and Response.Cookies in asp.net is there any reason to ever use javascript or any other method to use cookies? Thanks
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.