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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to turn off the cookies?

Status
Not open for further replies.
Oct 11, 2006
300
US
Hi,

I have a function which creates a cookies and sets the cookie value. The cookie stores the state of the browser which I left while I am seeing the reports so that when I come back to this page, I get to see last state I left it in. Users log into this page through Integrated Windows Authentication(IWA) where there NT ids are checked against the db. If they do not exist in the database, then a message appears that their names are not in the database.

At that time, I see an error at the Java Console - Object Expected at line 247.

Line 247 is the bold line in the following function:

Code:
function do_onload()
{
//alert("on_load");
//var cookiename=(typeof persisttype!="undefined" && persisttype=="sitewide")? "tabcontent" : window.location.pathname
var cookiename=window.location.pathname + '_tree'
var cookiecheck=get_cookie(cookiename).length != 0;
//alert(cookiename);
//alert(cookiecheck);
if (typeof enablepersistence!="undefined" && enablepersistence && cookiecheck)
{
openedItems = get_cookie(cookiename);
//alert("Here b4 '" + openedItems + "'");
var displayItems = openedItems.split("&");
for(i=0; i<displayItems.length; i++)
{
  if (displayItems[i].length != 0)
  {
    // Set the value to 'block'
    //alert(displayItems[i]);
    obj = document.getElementById(displayItems[i]).style;
    [b]obj.display = 'block';[/b]
  }
}
}

What can I do to turn this off, in case there is nothing on the form?

Thanks.
 
Use Firefox. Get Firebug (the debugger). Check the console. Report the (much more useful) error message to this thread. If you are using IE then often the line number reported has nothing to do with the actual error.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
[tt] if (displayItems.length != 0)
{
// Set the value to 'block'
//alert(displayItems);
[blue]if (document.getElementById(displayItems) {[/blue]
obj = document.getElementById(displayItems).style;
obj.display = 'block';
[blue]}[/blue]
}
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top