JavaScript Program to Save the Selected Color Value in Cookie and Retrive the value of it

Write a JavaScript program to save the selected color value in cookie and retrive the value of it.

Source Code
        <title>Sample Cookie</title>
        function saveCookie() {
            var c = document.forms.myform.color.value;
            document.cookie = "color=" + c + ";";
            alert("Cookie saved successfully !!!");

        function getCookie() {
    <p>Select the color</p>
    <form name="myform">
        <input type="radio" name="color" value="red">Red<br>
        <input type="radio" name="color" value="green">Green<br>
        <input type="radio" name="color" value="blue">Blue<br>
        <input type="button" value="Save Cookie" onclick="saveCookie()"> 
        <input type="button" value="Get Cookie" onclick="getCookie()"><br>