スキップしてメイン コンテンツに移動

投稿

ラベル(Progress bar)が付いた投稿を表示しています

html読み込みの進捗状況を表示するjavascriptのプログレスバー

以下のコードの coutUp functionをhtmlの途中に埋め込むことで、そのhtmlページの読み込みの進捗状況を表示することができます。(こういう方法がいいかどうかはわかりませんが。) function ProgressBar(id) { this.div = setProgressDIV(id); this.init = init; this.countUp = countUp; var progress; function setProgressDIV(id) { if(!id){ id = "_progress"+(new Date()).getTime(); var creprgDIV = document.createElement("DIV") ; this.div = document.body.appendChild(creprgDIV) ; this.div.setAttribute("id",id) ; this.div.style.position = "relative"; this.div.style.top = "0px"; this.div.style.left = "0px"; this.div.style.width = "0px"; this.div.style.height = "0px"; } else { this.div = document.getElementById(id) } this.div.style.color = 'blue' ; this.div.style.margin = '0px' ; this.div.style.padding = '4px'; this.div.prog_bar= '|'; this.div.prog_count

JavascriptでProgressBarを実装

Javascriptで簡単な プログレスバー を実装してみました!ソースコードは以下の通りです。 function ProgressBar(id, max_count, bar_char, color) { this.div = setupProgressDIV(id, max_count, bar_char, color); this.startProgress = startProgress; this.stopProgress = stopProgress; this.finish = finish; var finishFlag = 0; function setupProgressDIV(id, max_count, bar_char, color) { if(!id){ id = "_progress"+(new Date()).getTime(); if(document.getElementsByTagName('BODY').length==0) document.write('<body>') var creprgDIV = document.createElement("DIV") ; this.div = document.body.appendChild(creprgDIV) ; this.div.setAttribute("id",id) ; this.div.style.position = "relative"; this.div.style.top = "0px"; this.div.style.left = "0px"; this.div.style.width = "0px"; this.div.style.height = "0px"; } else { this.div = document.