while using the document cookie

<script typ="text/javascript"> 
        document.domain="example.com"; 
</script>

I acquired a mistake.i'm not sure the precise problem.

Error: uncaught exception: [Exception... "Illegal document.domain value" code: "1009" nsresult: "0x805303f1 (NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN)" location: ""]

Based on the HTML spec, document.domain is read-only. However, Opera enables setting it to some superdomain:

https://developer.mozilla.org/en/document.domain

Within the DOM HTML specs, this rentals are listed to be read-only. However, Mozilla enables you to place it to some superdomain of the present value, restricted by its base domain. For instance, on developer.mozilla.org you'll be able to place it to "mozilla.org" but not "mozilla.com" or "org".

The mistake you are getting clearly states that you are making an illegal domain assignment.

You mention snacks inside your question. If you are attempting to set the domain a part of a cookie, setting document.domain is not related to it. You have to give a domain parameter included in the cookie string that you are setting:

document.cookie = "foo=bar;domain=example.com";

More information here: https://developer.mozilla.org/en/DOM/document.cookie