N
Navillus
Hi all,
I have a cookie setup to store usernames and passwords for my site.
Additionally, I'd like to store some variables in the cookie, and be
able to extract them back out. I'm having trouble doing this. Here's my
code thus far:
<head>
<!-- Javascript functions
***************************************************************** -->
<script>
function StartURL()
{
var service_sel = document.premise_selection.service_sel.value;
var premise = document.premise_selection.Premise_sel.value;
<!--- start of insert
-->
<!--- save the selected premise to ac cookie
-->
var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear() + 1);
document.cookie = 'premise= '+ premise + '# expires='+
nextyear.toGMTString() +'; path= /';
<!--- end of insert
-->
var url = "http://`~http_host``~URLwgate`/" + service_sel + '!' +
'?EIAC-VSTELLE=' + premise + '&EIAC-OPBEL=' + " " + '&EIAC-WI_ID=' + "
" + '&~language=' + '`~language`';
parent.frames[2].location = url;
}
<!--- start of insert
-->
<!--- extract and use the value of the cookie named "premise"
-->
function GetPrem(prem)
{
var allcookies = document.cookie;
var position = allcookies.indexOf("premise=");
if (position != -1)
{
var start = position + 9;
var end = allcookies.indexOf(";", start); /* start of
cookie value */
if (end == -1) end = allcookies.length; /* end of value
*/
prem = allcookies.substring(start, end); /* extract value
*/
prem = unescape (prem); /* decode value
*/
}
}
<!--- end of insert
-->
</script>
</head>
<body `SAP_TemplateBodyAttributes()`>
<form name="premise_selection" method="post" action="`wgateurl()`">
<p>
<!--- start of insert
-->
<!--- over here, I'm calling the function GetPrem to get the previously
selected premise -->
<script> javascript:GetPrem(valueofprem); </script>
`premidx = 1`
<!--- end of insert
-->
<!-- pulldown field: premise -->
`for (j = 1; j <= PREMISE.dim; j++);`
`PremiseKey[j] = key[j];`
`PremiseContent[j] = premise[j];`
<!--- start of insert
-->
<!--- over here, I'm attempting to default the selection index to the
last premise selected -->
`if (valueofprem == key[j])`
`premidx = j`
`end`
<!--- end of insert
-->
`end`
I have a cookie setup to store usernames and passwords for my site.
Additionally, I'd like to store some variables in the cookie, and be
able to extract them back out. I'm having trouble doing this. Here's my
code thus far:
<head>
<!-- Javascript functions
***************************************************************** -->
<script>
function StartURL()
{
var service_sel = document.premise_selection.service_sel.value;
var premise = document.premise_selection.Premise_sel.value;
<!--- start of insert
-->
<!--- save the selected premise to ac cookie
-->
var nextyear = new Date();
nextyear.setFullYear(nextyear.getFullYear() + 1);
document.cookie = 'premise= '+ premise + '# expires='+
nextyear.toGMTString() +'; path= /';
<!--- end of insert
-->
var url = "http://`~http_host``~URLwgate`/" + service_sel + '!' +
'?EIAC-VSTELLE=' + premise + '&EIAC-OPBEL=' + " " + '&EIAC-WI_ID=' + "
" + '&~language=' + '`~language`';
parent.frames[2].location = url;
}
<!--- start of insert
-->
<!--- extract and use the value of the cookie named "premise"
-->
function GetPrem(prem)
{
var allcookies = document.cookie;
var position = allcookies.indexOf("premise=");
if (position != -1)
{
var start = position + 9;
var end = allcookies.indexOf(";", start); /* start of
cookie value */
if (end == -1) end = allcookies.length; /* end of value
*/
prem = allcookies.substring(start, end); /* extract value
*/
prem = unescape (prem); /* decode value
*/
}
}
<!--- end of insert
-->
</script>
</head>
<body `SAP_TemplateBodyAttributes()`>
<form name="premise_selection" method="post" action="`wgateurl()`">
<p>
<!--- start of insert
-->
<!--- over here, I'm calling the function GetPrem to get the previously
selected premise -->
<script> javascript:GetPrem(valueofprem); </script>
`premidx = 1`
<!--- end of insert
-->
<!-- pulldown field: premise -->
`for (j = 1; j <= PREMISE.dim; j++);`
`PremiseKey[j] = key[j];`
`PremiseContent[j] = premise[j];`
<!--- start of insert
-->
<!--- over here, I'm attempting to default the selection index to the
last premise selected -->
`if (valueofprem == key[j])`
`premidx = j`
`end`
<!--- end of insert
-->
`end`