Js achieves the effect of increasing the color of a square from bottom to bottom. js Square

Source: Internet
Author: User

Js achieves the effect of increasing the color of a square from bottom to bottom. js Square
<! 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> untitled document </title>
</Head>
<Script src = "jquery-1.8.2.js" type = "text/javascript"> </script>
<Script type = "text/javascript">
$ (Function (){
Interid = setInterval (Showgao, 1 );
Var I = 1;
$ ('# Top'). height (8 );
('{Buttom'{.css ('margintop ', 42 );
('{Buttom'{.css ('background ',' # d6d6d6 ');
Function Showgao ()
{
Var oldh1_detail ('{buttom'{.css ('margintop ');
Var h = oldH. substr (0, oldH. indexOf ('px '));
('{Buttom'{.css ('margintop ', h-1 );
$ ('# Buttom'). height (I );
I ++;
If (I = 42) {clearInterval (interid );}
}

Interid1 = setInterval (Showgao1, 1 );
Var i1 = 1;
$ ('# Top1'). height (4 );
('{Buttom1'{.css ('margintop ', 46 );
Certificate ('audio buttom1'audio .css ('background', 'red ');
Function Showgao1 ()
{
Var oldh1_detail ('{buttom1'{.css ('margintop ');
Var h = oldH. substr (0, oldH. indexOf ('px '));
('{Buttom1'{.css ('margintop ', h-1 );
$ ('# Buttom1'). height (i1 );
I1 ++;
If (i1 = 30) {clearInterval (interid1 );}
}
});
</Script>
<Body>
<Style>
. Container {width: 20px; height: 50px; border: 1px solid #999; font-size: 10px; float: left; margin-left: 5px ;}
</Style>
<Div class = "container" onclick = "javascript: alert (1);">
<Div id = "top"> 82% </div>
<Div id = "buttom"> </div>
</Div>
<Div class = "container" onclick = "javascript: alert (1);">
<Div id = "top1"> 62% </div>
<Div id = "buttom1"> </div>
</Div>
</Body>
</Html>


How does JS implement "entire site frame color transformation "?

You should first write several css files with different contents.
Then use js for Dynamic Loading
You just need to select which one to load with js.

Loading Method reference
Css = document. createElement ('link ');
Css. setAttribute ('href ', "stylesheet.css ");
Css. setAttribute ('rel ', 'stylesheet ');
Css. setAttribute ('type', 'text/css ');
Document. getElementsByTagName ('head') [0]. appendChild (css );

Js Code problems can be achieved by changing the font color inside JavaScript through external css.

{If $ css_ci % 2 = 0}

...... (If you want the text advertisement called by js to be blue, note that the following js contains the variable $
<Div style = "color: blue! Important; ">
<Script language = "javascript" src = "{APP_PATH} caches/poster_js/{$ css_ci}. js"> </script>
</Div>
{/If}

........
{Else}
...... (The text advertisement called by js is expected to be red. Note that the following js contains the variable $ css_ci)
<Div style = "color: red! Important; ">
<Script language = "javascript" src = "{APP_PATH} caches/poster_js/{$ css_ci}. js"> </script>
</Div>
{/If}

Try the above method. If there is no special treatment on the font color in the advertisement, there should be no problem.

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.