Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- </head>
- <body>
- <p id="1"></p>
- <select id="dd1theme" onchange="setColor();">
- <option value="Select Color">Select Color</option>
- <option value="red">Red</option>
- <option value="green">green</option>
- <option value="blue">Blue</option>
- </select>
- <script type="text/javascript">
- window.onload = function () {
- if(document.cookie.length!=0){
- var nameValue=document.cookie.split("=");
- document.bgColor=nameValue[1];
- document.getElementById("1").innerHTML=nameValue[1];
- document.getElementById("dd1theme").value=nameValue[1];
- }
- }
- function setColor() {
- var selected=document.getElementById("dd1theme").value;
- if(selected != "Select Color" ){
- document.bgColor=selected;
- var d = new Date();
- exdays=10;
- d.setTime(d.getTime() + (exdays*24*60*60*1000));
- var expires = d.toGMTString();
- document.cookie="color="+selected+";expires="+expires;
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement