勤现在-乐将来
用 户:
密 码:
记住我
周一,2008 十 27 03:48:41
点击运行,这样的颜色让人感觉很舒服.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>舒服的颜色</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <style type="text/css"> body{ margin:20px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size:12px; } .style1{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #96C2F1; background-color: #EFF7FF } .style1 h5{ margin: 1px; background-color: #B2D3F5; height: 24px; } .style2{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #9BDF70; background-color: #F0FBEB } .style2 h5{ margin: 1px; background-color: #C2ECA7; height: 24px; } .style3{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #BBE1F1; background-color: #EEFAFF } .style4{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #CCEFF5; background-color: #FAFCFD } .style5{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #FFCC00; background-color: #FFFFF7 } .style6{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #92B0DD; background-color: #FFFFFf } .style6 h5{ margin: 1px; background-color: #E2EAF8; height: 24px; } .style7{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #A9C9E2; background-color: #E8F5FE } .style8{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #E3E197; background-color: #FFFFDD } .style9{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #ADCD3C; background-color: #F2FDDB } .style10{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #F8B3D0; background-color: #FFF5FA } .style11{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #D3D3D3; background-color: #F7F7F7 } .style12{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #BFD1EB; background-color: #F3FAFF } .style13{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #FFDD99; background-color: #FFF9ED } .style14{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #CACAFF; background-color: #F7F7FF } .style15{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #A5B6C8; background-color: #EEF3F7 } .style16{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #CEE3E9; background-color: #F1F7F9 } .style17{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #CAE3FF; background-color: #F4F9FF } .style18{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #C9D9EE; background-color: #ECF8FF } .style19{ width: 800px; height: 100px; margin: 0px auto; margin-bottom:20px; border:1px solid #5C9CC0; background-color: #F2FAFF } h5{color:#CCCCCC;margin-left:680px} a{color:#CCCCCC;text-decoration:none} a:hover{color:#666666;text-decoration:underline} </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head> <body> <div class="style2"><h5></h5></div> <div class="style6"><h5></h5></div> <div class="style3"></div> <div class="style4"></div> <div class="style5"></div> <div class="style7"></div> <div class="style8"></div> <div class="style9"></div> <div class="style10"></div> <div class="style11"></div> <div class="style12"></div> <div class="style13"></div> <div class="style14"></div> <div class="style15"></div> <div class="style16"></div> <div class="style17"></div> <div class="style18"></div> <div class="style19"></div> </body> </html>
提示:你可以先修改部分代码再运行。
周五,2008 十 10 00:03:35
一个简单的调色版.效果不错.
<!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" /> <title>红辣椒的调色板</title> <style> table{background:#000;} tr,td{background:#fff; padding: 10px;} #colorBoard{position:absolute; padding:10px; width:256px; height:220px; background:#f3f3f3; border:#d9d9d9 1px solid;} #colorBank{ clear:both; border:#d9d9d9 1px solid; background:#FFF; width:252px; padding:0 0 2px 2px; overflow:hidden; margin:0 auto 0 auto;} #colorBank div{ overflow:hidden; height:12px; width:12px; margin:2px 2px 0 0; float:left; overflow:hidden; cursor:pointer;} #colorViews{width:80px; height:20px; float:left;border:#d9d9d9 1px solid; background:#000; display:block; margin: 0 10px 10px 0;} #colorInput{width:70px; height:18px; float:left; font-family:Verdana; font-size:13px; color:#333; display:block; border:none; background:#FFF;border:#d9d9d9 1px solid;margin: 0 10px 10px 0;} #colorClose{width:80px; color:#999999; height:22px; float:left;display:block; background:#f3f3f3;cursor:pointer;border:#d9d9d9 1px solid; border-top:#FFF 1px solid; border-left:#FFF 1px solid;} </style> <script type="text/javascript"> //红辣椒的调色板 function colorSelect(now,page,e){ if(document.getElementById("colorBoard")){ return; } //关于出现位置 e=e||event; var scrollpos = getScrollPos(); var l = scrollpos.l + e.clientX; var t = scrollpos.t + e.clientY + 10; if (l > getBody().clientWidth-253){ l = getBody().clientWidth-253; } //创建DOM var nowColor = document.getElementById(now); var pageColorViews = document.getElementById(page); var ColorHex=new Array('00','33','66','99','CC','FF'); var SpColorHex=new Array('FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF'); var colorBank = document.createElement("div"); colorBank.setAttribute("id","colorBank"); var colorViews = document.createElement("div"); colorViews.setAttribute("id","colorViews"); var colorInput = document.createElement("input"); colorInput.setAttribute("id","colorInput"); colorInput.setAttribute("type","text"); colorInput.setAttribute("disabled","disabled"); var colorClose = document.createElement("input"); colorClose.setAttribute("id","colorClose"); colorClose.setAttribute("value","取消"); colorClose.setAttribute("type","button"); colorClose.onclick=function(){document.body.removeChild(colorBoard)}; var colorBoard =document.createElement("div"); colorBoard.id="colorBoard"; colorBoard.style.left = l+"px"; colorBoard.style.top = t+ "px"; colorBoard.appendChild(colorViews); colorBoard.appendChild(colorInput); colorBoard.appendChild(colorClose); colorBoard.appendChild(colorBank); document.body.appendChild(colorBoard); //循环出调色板 for(b=0;b<6;b++){ for(a=0;a<3;a++){ for(i=0;i<6;i++){ colorItem = document.createElement("div"); colorItem.style.backgroundColor="#"+ColorHex[a]+ColorHex[i]+ColorHex[b]; colorBank.appendChild(colorItem); } } } for(b=0;b<6;b++){ for(a=3;a<6;a++){ for(i=0;i<6;i++){ colorItem = document.createElement("div"); colorItem.style.backgroundColor="#"+ColorHex[a]+ColorHex[i]+ColorHex[b]; colorBank.appendChild(colorItem); } } } for(i=0;i<6;i++){ colorItem = document.createElement("div"); colorItem.style.backgroundColor="#"+ColorHex[0]+ColorHex[0]+ColorHex[0]; colorBank.appendChild(colorItem); } for(i=0;i<6;i++){ colorItem = document.createElement("div"); colorItem.style.backgroundColor="#"+ColorHex[i]+ColorHex[i]+ColorHex[i]; colorBank.appendChild(colorItem); } for(i=0;i<6;i++){ colorItem = document.createElement("div"); colorItem.style.backgroundColor="#"+SpColorHex[i]; colorBank.appendChild(colorItem); } var colorItems = colorBank.getElementsByTagName("div"); for(i=0; i<colorItems.length;i++){ colorItems[i].onmouseover = function(){ a = this.style.backgroundColor; if(a.length>7){ a = formatRgb(a);// } colorViews.style.background = a.toUpperCase(); colorInput.value = a.toUpperCase(); } colorItems[i].onclick = function(){ a = this.style.backgroundColor; if(a.length>7){ a = formatRgb(a);// } nowColor.value = a.toUpperCase(); pageColorViews.style.background = a.toUpperCase(); document.body.removeChild(colorBoard); } } } //格式化函数 function formatRgb(rgb){ rgb = rgb.replace("rgb","");rgb = rgb.replace("(","");rgb = rgb.replace(")",""); format = rgb.split(","); a = eval(format[0]).toString(16); b = eval(format[1]).toString(16); c = eval(format[2]).toString(16); rgb = "#"+checkFF(a)+checkFF(b)+checkFF(c); function checkFF(str){ if(str.length == 1){ str = str+""+str; return str; }else{ return str; } } return rgb; } //getBody() function getBody(){ var Body; if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') { Body = document.documentElement; } else if (typeof document.body != 'undefined') { Body = document.body; } return Body; } //scrollPos function getScrollPos(){ var t,l; if (typeof window.pageYOffset != 'undefined'){ t = window.pageYOffset; l = window.pageXOffset; } else{ t = getBody().scrollTop; l = getBody().scrollLeft; } return {t:t,l:l}; } </script> </head> <body> <table width="400" cellpadding="0" cellspacing="1"> <tr> <td><input type="text" value="" id="nowColor" /></td> <td><div id="pageColorViews" style="background:#000; width:30px; height:30px;"></div></td> <td><a href="javascript:;" onclick="colorSelect('nowColor','pageColorViews',event)">点我就出调色板</a></td> </tr> </table> </body> </html>
欢迎来到等待的博客,这里是一个记录自己学习过程中的点点滴滴,以及和大家分享一些关于前端技术方面的技巧。如果你喜欢本站的文章,可以点击上面的RSS图标订阅本站。 本站网络空间提供