Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading Progress Bar

 
AnandEdward
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Please give me a solution for this ,

Iam using a function for loading indicator.Actualy that function is to be given in "onLoad" function,but i need to use that function
in onClick event of Button.

Function used :

<script language="javascript">

var w3c=(document.getElementById)?true:false;
var ie=(document.all)?true:false;
var N=-1;
var bars=new Array();
var int;

function statusbar(){
createBar(320,15,'white',1,'black','darkblue',85,7,5);
}

function createBar(w,h,bgc,brdW,brdC,blkC,speed,blocks){
if(ie||w3c){
var t='<div style="position:relative; overflow:hidden; width:'+w+'px; height:'+h+'px; background-color:'+bgc+'; border-color:'+brdC+'; border-width:'+brdW+'px; border-style:solid; font-size:1px;">';
t+='<span id="blocks'+(++N)+'" style="left:-'+(h*2+1)+'px; position:absolute; font-size:1px">';
for(i=0;i<blocks;i++){
t+='<span style="background-color:'+blkC+'; left:-'+((h*i)+i)+'px; font-size:1px; position:absolute; width:'+h+'px; height:'+h+'px; '
t+=(ie)?'filter:alpha(opacity='+(100-i*(100/blocks))+')':'-Moz-opacity:'+((100-i*(100/blocks))/100);
t+='"></span>';
}
t+='</span></div>';
document.write("Plese Wait"+t);
var bA=(ie)?document.all['blocks'+N] ocument.getElementById('blocks'+N);
alert(bA.blocks=blocks);
bA.blocks=blocks;
bA.w=w;
bA.h=h;
bars[bars.length]=bA;
int=setInterval('startBar('+N+')',speed);

}

}

function startBar(bn){

var t=bars[bn];

t.style.left=((parseInt(t.style.left)+t.h+1-(t.blocks*t.h+t.blocks)>t.w)? -(t.h*2+1) : parseInt(t.style.left)+t.h+1)+'px';
}

function stop(){
window.clearInterval(int);
}
document.onstop=stop;

</script>

Problem:
Iam facing "object expected problem" when iam using the statusBar() function in onClick event of Button.
[ March 25, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can not use document.write after the page load.

You either need to figure out how ti use innerHTML or appendChild() to get the elment on the page. OR you have the progress bar built on page load, you just hide it from view until you need it.

Eric
 
AnandEdward
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anand Edward:
Hi
Please give me a solution for this ,

I am using a function for loading indicator.Actualy that function is to be given in "onLoad" function,but i need to use that function
in onClick event of Button.

Function used :

Problem:
I am facing "object expected problem" when i am using the statusBar() function in onClick event of Button.




hi thank you for response, i am try to work on hide and show function, these function same thing problem occur in object required errorplease give me the solution
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not see anywhere where you have an element surrounding the loading bar with the display set to none. Than you should have a show function that sets the element to block.

If you are getting an object expected, that probably means you are not referencing the element's id correctly.

Eric
 
AnandEdward
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i am facing object request error in the block followingly



these function only making the error.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said before you can not use document.write("Plese Wait"+t); after the page load. Are you calling the status method on the click evernt?

Eric
 
AnandEdward
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Eric

i am using document.write("PleaseWait"+t) in after page load, it's showing the error in undefined is null or not an object.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic