标签:order function 最大值 charset padding com XML oct org
代码如下:
<!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 type="text/css"> *{ margin:0px auto; padding:0px} #kuang{ width:200px; height:10px; border:1px solid #60F;} #jindu{ height:10px; background-color:#F03; float:left} </style> </head> <body> <br /> <div id="kuang"> <div id="jindu" style="width:0px"></div> </div> <script type="text/javascript"> window.setTimeout("jindu()",30); //调一下进度前进1% function jindu() { //获取进度div的宽度 var div = document.getElementById("jindu"); //获取到的是字符串"0px" var str = div.style.width; //处理字符串获取数字 var cd = str.substr(0,str.length-2); //判断长度是否到最大值 if(cd<200) { //将长度转为整数加2 var cd = parseInt(cd)+2; //让进度的DIV长度变为cd div.style.width = cd+"px"; //调用自身 window.setTimeout("jindu()",30); } } </script> </body> </html>
效果如图:
标签:order function 最大值 charset padding com XML oct org
原文地址:http://www.cnblogs.com/bhmmlxieliming/p/6384443.html