JavaScript code for controlling css pages

Source: Internet
Author: User
Tip: you can modify some code before running

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><ptml xmlns="http://www.w3.org/1999/xhtml"><pead><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>Skin change</title><style type="text/css">Body {font-size: 12px} * {margin: 0; padding: 0;} ul, li {list-style: none }. login_skin {height: 25px; background: # E8E8E8; border: 1px solid # e9e8e5; width: 215px; color: #333; line-height: 25px; margin: 25px 0px 25px 10px; padding-left: 15px ;}. login_skin li {float: left }. login_skin. bor {border-right: 1px solid # e9e8e5; padding-right: 7px; margin-right: 10px }. login_skin li span {margin: 7px 4px 0px 0px; cursor: pointer; display: block }. login_skin li span em {display: block; height: 9px; width: 10px; overflow: hidden; text-indent:-9999px }. login_skin a {color: #333; text-decoration: none; margin-right: 5px }. login_skin li. on {border: 1px solid #333; cursor: default} h2 {font-size: 12px; padding: 8px 0px 10px 15px} # sk_blue {background: #2086b3 ;} # sk_or {background: # e64c13} # sk_byu {background: # b7a37a ;}# warpper {overflow: hidden; height: 1% }. contentl {margin-right:-244px; float: left; width: 100% }. contentr {width: 230px; float: right ;}. main {margin-right: 254px; margin-left: 10px; height: 300px }. footer {height: 30px; margin: 30px 10px 0px 10px }. blue. content {background: #2086b3; color: # fff ;}. blue. bb {border: 2px solid #2086b3 ;}. blue. footer {background: #2086b3 ;}. or. content {background: # e64c13 }. or. bb {border: 2px solid # e64c13 ;}. or. footer {background: # e64c13 ;}. byu. content {background: # b7a37a; color: # f00 }. byu. bb {border: 2px solid # b7a37a ;}. byu. footer {background: # b7a37a ;}</style><script type="text/javascript">Function setOnloadEvent (func) {var oldonload = window. onload; if (typeof window. onload! = "Function") {window. onload = func;} else {window. onload = function () {oldonload (); func () ;}}// --- set cookiefunction setCookie (name, value, days) {if (days) {var date = new Date (); date. setTime (date. getTime () + (days * 24x60*60*1000); var expires = "; expires =" + date. toGMTString ();} else expires = ""; document. cookie = name + "=" + value + expires + "; path =/" ;}// --- get cookiefunction getCookie (name) {va R nameEQ = name + "="; var ca = document. cookie. split (';'); for (var I = 0; I <ca. length; I ++) {var c = ca [I]; while (c. charAt (0) = '') c = c. substring (1, c. length); if (c. indexOf (nameEQ) = 0) return c. substring (nameEQ. length, c. length);} return null;} function skin () {if (! Document. getElementsByTagName) return false; if (! Document. getElementById ("skin") return false; var skin_id = "blue"; if (getCookie ("id ")! = Null) {skin_id = getCookie ("id");} var span_id = skin_id + "_ sp"; var span_on = document. getElementById (span_id); document. body. className = skin_id; span_on.className = "on"; var skinType = document. getElementById ("skin"); var skin_nub = skinType. getElementsByTagName ("em"); for (var I = 0; I<skin_nub.length;i++){ skin_nub[i].onclick=function(){ var em_id=this.getAttribute("id"); var skin_id=em_id.split("_")[1]; var spanList=document.getElementsByTagName("span"); for(var j=0;j</pead><body><div id="header"><div class="login_skin" id="skin"> <ul><li>Login</li><li class="bor">Register</li><li>Select the page style:</li><li><em id="sk_blue">Ee</em></li><li><em id="sk_or">Ere</em></li><li><em id="sk_byu">Ere</em></li> </ul></div></div><div id="warpper"> <div class="contentl" > <div class="main bb"><p>Skin replacement test</p></div> </div> <div class="contentr bb" ><p>Skin replacement test</p></div></div><div class="footer"></div></body></ptml>
Tip: you can modify some code before running
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.