⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cookiesexample2.htm

📁 这是javascript高级程序设计的源码
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
    <head>
        <title>Cookies Example</title>   
        <script type="text/javascript">
                              
                function getCookie(sName) {
                
                    var sRE = "(?:; )?" + sName + "=([^;]*);?";
                    var oRE = new RegExp(sRE);
                    
                    if (oRE.test(document.cookie)) {
                        return decodeURIComponent(RegExp["$1"]);
                    } else {
                        return null;
                    }
                
                }                

                window.onload = function () {
                
                    var sName = getCookie("personName");
                    var sEmail = getCookie("personEmail");
                
                    if (sName && sEmail) {
                        var oForm = document.forms["feedbackForm"];
                        oForm.personName.value = sName;
                        oForm.personEmail.value = sEmail;
                    }
                };
               
        </script>           
    </head>
    <body>
        <p>This is a sample feedback form using cookies. This example requires
        you to use PHP for server-side processing.</p>
        <form name="feedbackForm" method="post" action="submitfeedback.php">
                <p>Name: <input type="text" name="personName" /><br />
                E-mail Address: <input type="text" name="personEmail" /><br />
                Feedback:<br /> <textarea rows="10" cols="50" name="feedbackText"></textarea><br />
                <input type="checkbox" name="rememberMe" value="yes" /> Remember Me<br />
                <input type="submit" value="Submit Feedback" />
        </form>
        
 
    </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -