Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How to get values from cookies to set widgets?
How to get values from cookies to set widgets?
✍: Guest
function getCookieData(labelName) { //from Danny Goodman var labelLen = labelName.length; // read cookie property only once for speed var cookieData = document.cookie; var cLen = cookieData.length; var i = 0; var cEnd; while (i < cLen) { var j = i + labelLen; if (cookieData.substring(i,j) == labelName) { cEnd = cookieData.indexOf(";",j); if (cEnd == -1) { cEnd = cookieData.length; } return unescape(cookieData.substring(j+1, cEnd)); } i++; } return ""; } //init() is called from the body tag onload function. function init() { setValueFromCookie("brand"); setValueFromCookie("market"); setValueFromCookie("measure"); } function setValueFromCookie(widget) { if (getCookieData(widget) != "") { document.getElementById(widget).value = getCookieData(widget); } } //if you name your cookies the widget ID, you can use the following helper function function setCookie(widget) { document.cookie = widget + "=" + escape(document.getElementById(widget).value) + getExpirationString(); }
2009-01-20, 4135👍, 0💬
Popular Posts:
What is Shell scripting A shell script is a script written for the shell, or command line interprete...
Describe different elements in Static Chart diagrams ? Package: - It logically groups element of a U...
What is the benefit of using #define to declare a constant? Using the #define method of declaring a ...
.NET INTERVIEW QUESTIONS - Can we use events with threading ? Yes, you can use events with thread; t...
How To Delete a User Account? - Oracle DBA FAQ - Managing Oracle User Accounts, Schema and Privilege...