I have two web pages. Both are published from Excel Pivot Tables and Charts. I have added similar javascript code (the cookie functions and calls are identical, only the cookie names and values differ). The getCookie call works in the first page, but renders "object expected" in the second page.
Cookie functions from first page placed just prior to </head>...
Cookie functions from second page placed just prior to </head>...
Function call from first page...this one works...
Function call from second page...it stops on the getCookie call...
Function calls are placed in the same position in both pages. Both pages were published from the same version of Excel.
Any ideas?
Thanks!
Ray <><
"I was going to change my shirt, but I changed my mind instead." - Winnie the Pooh
Cookie functions from first page placed just prior to </head>...
Code:
<script language="Javascript">
// cookie functions added 08/04/2005 - RLH
function getCookie(name)
{
var arg = name + '=';
var arglen = arg.length;
var acookiejar = new Array();
acookiejar = document.cookie.split('; ');
var cookiecnt = acookiejar.length;
var i = 0;
while (i < cookiecnt)
{
if (acookiejar[i].substring(0, arglen) == arg)
{
var thecookie = unescape(acookiejar[i]);
var cookielen = thecookie.length;
var thefilling = thecookie.substring(arglen, cookielen);
return thefilling;
}
i = i + 1;
}
return null;
}
function setCookie(name, value, expires, path, domain, secure)
{
var midnight = new Date()
midnight.setHours(23,59,59,999)
expires = midnight
var curCookie = name + '=' + escape(value)
+ ((expires) ? '; expires=' + expires.toGMTString() : '')
+ ((path) ? '; path=' + path : '')
+ ((domain) ? '; domain=' + domain : '')
+ ((secure) ? '; secure' : '');
document.cookie = curCookie
}
// end of cookie functions
</script>
Cookie functions from second page placed just prior to </head>...
Code:
<script language="Javascript">
//cookie code added 08/04/2005 - RLH
function getCookie(name)
{
var arg = name + '=';
var arglen = arg.length;
var acookiejar = new Array();
acookiejar = document.cookie.split('; ');
var cookiecnt = acookiejar.length;
var i = 0;
while (i < cookiecnt)
{
if (acookiejar[i].substring(0, arglen) == arg)
{
var thecookie = unescape(acookiejar[i]);
var cookielen = thecookie.length;
var thefilling = thecookie.substring(arglen, cookielen);
return thefilling;
}
i = i + 1;
}
return null;
}
function setCookie(name, value, expires, path, domain, secure)
{
var midnight = new Date();
midnight.setHours(23,59,59,999);
expires = midnight;
var curCookie = name + '=' + escape(value)
+ ((expires) ? '; expires=' + expires.toGMTString() : '')
+ ((path) ? '; path=' + path : '')
+ ((domain) ? '; domain=' + domain : '')
+ ((secure) ? '; secure' : '')
document.cookie = curCookie;
}
//end of cookie code
</script>
Function call from first page...this one works...
Code:
<script language="javascript">
// Initialize object variables
var pt = document.getElementById('Book1_24147_PivotTable');
var pv = pt.Activeview;
var fa = pv.FilterAxis;
// Set filtering for the Date Ranges dimension
var currlevel = getCookie('sedrlevel');
Function call from second page...it stops on the getCookie call...
Code:
<script language="Javascript">
// Initialize object variables
var pt = document.getElementById('EAC_History_17823_PivotTable');
var pv = pt.Activeview;
var fa = pv.FilterAxis;
// Set filtering for the Record Type FieldSet
var currlevel = getCookie('eacrtlevel');
Function calls are placed in the same position in both pages. Both pages were published from the same version of Excel.
Any ideas?
Thanks!
Ray <><
"I was going to change my shirt, but I changed my mind instead." - Winnie the Pooh