Read cookie value : Cookie « Development « JavaScript Tutorial






<html>
<head>
<title></title>
<script language="JavaScript">
<!--
function fillIn()
{
    if (document.cookie != "")
    {
        cookieCrumb = document.cookie.split("=")[1];
        document.form1.read1.value = cookieCrumb;
    }
    else
    {
        document.form1.read1.value = "Cookie empty!";
    }
}
//  -->
</script>
</head>
<body onload="fillIn()">
<form name="form1">
<P>The username you entered was: <input type="text" name="read1"></p>
</form>
</body>
</html>








4.4.Cookie
4.4.1.JavaScript and Cookies
4.4.2.Reading Cookies
4.4.3.Writing Cookies
4.4.4.Create a cookie and read it back
4.4.5.Make cookie using Javascript
4.4.6.Delete all cookies
4.4.7.Read cookie value