<style type="text/css">
#f{
height:10px; border:1px solid;
background-color:blue;
}
</style>
</head> <body>
<div id="f"></div>
<script>
var w=parseInt(document.getElementById("f").style.width); while(w<50) {
w++;
} ;
</script>
</body>
</html>
#f{
height:10px; border:1px solid;
background-color:blue;
}
</style>
</head> <body>
<div id="f"></div>
<script>
var w=parseInt(document.getElementById("f").style.width); while(w<50) {
w++;
} ;
</script>
</body>
</html>
解决方案 »
- 过滤器的使用
- 在extjs里如何对汉字进行显式编码
- 跪求这个网站上的层轮显的效果怎么做?
- 麻烦朋友介绍一本学习javascript的书籍。
- js弹出层 随页面滚动都居中,遇到点问题,还请大家帮帮忙,代码如下.
- 求个简单的特效
- 正在开发一套基于ASP。NET+AJAX的BLOG系充,已经到开发后期,肯请大家来拍砖提意见!!
- 100分请教一个页面取值问题,在线等
- 请教一个有关于iframe的问题
- 这个servlet为什么有时会出现 Internal Server Error 的,明明只有两行代码,有时执行成功,有时执行会失败,不得其解???
- 跪求一个的js问题,亟待解决!!!
- 如何查找节点内元素并增加CSS
<html>
<head>
<style type="text/css">
#f{
height:10px;
border:1px solid;
background-color:blue;
}
</style>
<script>
window.onload=function(){
var w=0;
while(w<5500){
w++;
document.getElementById("f").style.width=w+'px';
}
}
</script>
</head>
<body>
<div id="f"></div>
</body>
</html>
实现不了 进度条一般的 渐进效果。
难道非要用setTimeout不可?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8" >
<title>测试</title>
<style type="text/css">
#process{
height: 20px;
width : 0px;
border: 1px solid #ccc;
background-color:#ccc;
}
#bar{
width : 202px;
overflow: hidden;
border : 1px solid blue;
text-align: center;
}
#bar span{
display : block;
margin-top : -20px;
}
</style>
</head>
<body>
<div id="bar">
<div id="process"></div>
<span id="rate" ></span>
</div><script>
var $ = function(id){
return document.getElementById(id);
};var totalW = $("bar").offsetWidth;
var style = $("process").style;
var rate = $("rate");var anima = window.setInterval(function(){
var width = parseInt(style.width||0);
if( width >= totalW ){
rate.innerHTML = "100%";
window.clearInterval( anima );
}else{
var newWidth = width+5;
style.width = newWidth + "px";
rate.innerHTML = Math.floor(newWidth/totalW*100) + "%" ;
}
}, 100);
</script>
</body>
</html>
*{
padding: 0;
margin:0;
} #main{
margin: 30px;
width: 300px;
height: 10px;
border: 1px solid red;
}
#son{
width: 0;
height: 10px;
background-color: pink;
} </style> <script type="text/javascript">
var i=1;
/*function test(){
f();
}//*/
function f(){
var code = document.getElementById("son").style.width=i+"px";
i++;
if(i<=300) {
t=setTimeout("f()",50);//这里改变速度.
}
} </script> </HEAD> <BODY> <div id="main">
<div id="son">
</div>
</div>
<input type="button" value="start" onclick="f()"/> </BODY></HTML>