Last active
February 29, 2016 06:51
-
-
Save yehchge/9fb8f0679b74b2bcc01d to your computer and use it in GitHub Desktop.
Javascript 進度條
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript"> | |
var bar_width = 200; | |
function progress() { | |
var node = document.getElementById('progress'); | |
var w = node.style.width.match(/\d+/); | |
if (w == bar_width) { | |
w = 0; | |
} | |
node.style.width = parseInt(w) + 5 + 'px'; | |
} | |
</script> | |
</head> | |
<body onload="var progress_run_id = setInterval(progress, 250);"> | |
<div style="border: 1px solid black; width:200px; height:5px;"> | |
<div id="progress" style="height:5px; width:0px; background-color:red;"/> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment