Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. //<![CDATA[
  2. /**
  3. * This function returns the named cookie if it exists.
  4. * @param {type} cname The name of the cookie.
  5. * @returns {String} The cookie value,
  6. */
  7. function getCookie(cname) {
  8. var name = cname + "=";
  9. var ca = document.cookie.split(';');
  10. for (var i = 0; i < ca.length; i++) {
  11. var c = ca[i];
  12. while (c.charAt(0) === ' ') {
  13. c = c.substring(1);
  14. }
  15. if (c.indexOf(name) === 0) {
  16. return c.substring(name.length, c.length);
  17. }
  18. }
  19. return "";
  20. }
  21. //]]>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement