js实现正方形颜色从下往上升的效果
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<title>无标题文档</title>
</head>
<scriptsrc="jquery-1.8.2.js"type="text/javascript"></script>
<scripttype="text/javascript">
$(function(){
interid=setInterval(Showgao,1);
vari=1;
$('#top').height(8);
$('#buttom').css('marginTop',42);
$('#buttom').css('background','#d6d6d6');
functionShowgao()
{
varoldH=$('#buttom').css('marginTop');
varh=oldH.substr(0,oldH.indexOf('px'));
$('#buttom').css('marginTop',h-1);
$('#buttom').height(i);
i++;
if(i==42){clearInterval(interid);}
}
interid1=setInterval(Showgao1,1);
vari1=1;
$('#top1').height(4);
$('#buttom1').css('marginTop',46);
$('#buttom1').css('background','red');
functionShowgao1()
{
varoldH=$('#buttom1').css('marginTop');
varh=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:1pxsolid#999;font-size:10px;float:left;margin-left:5px;}
</style>
<divclass="container"onclick="javascript:alert(1);">
<divid="top">82%</div>
<divid="buttom"></div>
</div>
<divclass="container"onclick="javascript:alert(1);">
<divid="top1">62%</div>
<divid="buttom1"></div>
</div>
</body>
</html>热门推荐
10 朋友新年祝福语大全 简短
11 新年祝福语简短大方兔年
12 搬新家礼物祝福语简短
13 同学见面花束祝福语简短
14 五一假期祝福语幽默简短
15 离职欢送敬酒祝福语简短
16 对学弟的祝福语简短
17 考老师辞职祝福语简短
18 祝福语驱散霉运的话简短