zoukankan      html  css  js  c++  java
  • html5实现的一些效果

    一、网页换肤

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="utf-8">
    		<title>网页换肤</title>
    		<script type="text/javascript">
    		   
    		    //检查浏览器是否支持localStorage
    
    			if(typeof localStorage==='undefined'){
    				window.alert("not support localStorage");				
    			}else{
    				window.alert("support localStorage");
    				var storage = localStorage;
    				//设置DIV背景颜色为红色,并保存localStorage
    				function redSet(){
    					var value = "red";
    					document.getElementById("divblock").style.backgroundColor = value;
    					window.localStorage.setItem("DivBackGroundColor",value);
    				}
    				
    				function greenSet(){
    					var value = "green";
    					document.getElementById("divblock").style.backgroundColor = value;
    					window.localStorage.setItem("DivBackGroundColor",value);
    				}
    				
    				function blueSet(){
    					var value = "blue";
    					document.getElementById("divblock").style.backgroundColor = value;
    					window.localStorage.setItem("DivBackGroundColor",value);
    				}
    				
    				function colorload(){
    					document.getElementById("divblock").style.backgroundColor = window.localStorage.getItem("DivBackGroundColor");
    				}
    			}
    		</script>
    	</head>
    	<body onload="colorload()">
    		<section id="main">
    			<button id="redbutton" onclick="redSet()">红色</button>
    			<button id="greenbutton" onclick="greenSet()">绿色</button>
    			<button id="bluebutton" onclick="blueSet()">蓝色</button>
    			<div id="divblock" style=" 500px; height: 500px;"></div>
    		</section>
    	</body>
    </html>
    
  • 相关阅读:
    cocos2d-x 游戏暂停界面,监听home键,返回键,Menu键 解决方案
    转载cocos2dx的各种动作用法
    cocso2d-x改变精灵图片
    cocos2d-x 菜单
    for循环
    nginx限制IP访问网站
    zabbix server in not running
    筛选nginx访问日志文件中的域名
    Zabbix历史数据清理
    http跳转http
  • 原文地址:https://www.cnblogs.com/zhuiluoyu/p/4568735.html
Copyright © 2011-2022 走看看