zoukankan      html  css  js  c++  java
  • 颜色渐变

    颜色渐变:

    代码
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    #block
    { width:400px;}
    </style>
    <script type="text/javascript">
        window.onload
    =function(){
            document.getElementById(
    "block").style.backgroundColor="#ffffff";
            setTimeout(
    "colorFlash(255)",300);
        }
        
        
    function colorFlash(newColor){
            
    var hexVal=newColor.toString(16);
            
            
    if(hexVal.length<2){
                hexVal
    ="0"+hexVal;
            }
            
            
    var colorString="#ffff"+hexVal;
            
    var blockDiv=document.getElementById("block");
            blockDiv.style.backgroundColor
    =colorString;
            
    if(newColor>0){
                newColor
    -=5;
                setTimeout(
    "colorFlash("+newColor+")",50);
            }
        }
    </script>
    </head>
    <body>
    <div id="block">
    <p>hello</p>
    </div>
    </body>
    </html>
  • 相关阅读:
    CSS3的box-sizing属性
    html5 --基础笔记2
    html5--基础笔记
    CSS3--阴影,渐变,背景图片
    响应式布局--流式布局
    angular中的this指向问题
    angular中控制器之间的通讯方式
    angular中的$http配置和参数
    console
    h5表单验证的css和js方法
  • 原文地址:https://www.cnblogs.com/Fskjb/p/1761906.html
Copyright © 2011-2022 走看看