Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Object Expected" at function call...

Status
Not open for further replies.

rheilman

Programmer
Dec 6, 2002
51
0
0
US
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>...
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
 
The error is not occurring where I thought. When the page was republished, the ID of the pivot table object changed and therefore, my initial reference was invalid.

Thanks!
Ray <><

"I was going to change my shirt, but I changed my mind instead." - Winnie the Pooh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top