TsukiShimizu
07-11-2011, 07:01 PM
Hello.
I'm working on a progressbar for my blog, and I've looking for a method to easily controll the text it shows, since it's always one of 8 states.
For this i wanted to create a javascript and a switch which would give the right percentage of filling for the progressbar. Unfortunatly it doesn't fill the progressbar as wanted.
<script type="text/javascript">
var t = 6;
function percent()
{
switch (t)
{
case 1:
return 12.5;
break;
case 2:
return 25;
break;
case 3:
return 37.5;
break;
case 4:
return 50;
break;
case 5:
return 62.5;
break;
case 6:
return 75;
break;
case 7:
return 87.5;
break;
case 8:
return 100;
break;
case 0:
return 0;
break;
default:
return 0;
}
}
</script>
<div class="”goal”" style="”width:195px;height:15px;background:#0d0d1c;border:solid" 1px="">
<div class="”progress”" style="height:15px;background:#1e90ff;color:white;width:javascript:percent()%"><b>0</b>
</div></div>
Could someone show me where I am going wrong with this please?
And if it matters: My blog is a *.blogspot.com
Thanks
I'm working on a progressbar for my blog, and I've looking for a method to easily controll the text it shows, since it's always one of 8 states.
For this i wanted to create a javascript and a switch which would give the right percentage of filling for the progressbar. Unfortunatly it doesn't fill the progressbar as wanted.
<script type="text/javascript">
var t = 6;
function percent()
{
switch (t)
{
case 1:
return 12.5;
break;
case 2:
return 25;
break;
case 3:
return 37.5;
break;
case 4:
return 50;
break;
case 5:
return 62.5;
break;
case 6:
return 75;
break;
case 7:
return 87.5;
break;
case 8:
return 100;
break;
case 0:
return 0;
break;
default:
return 0;
}
}
</script>
<div class="”goal”" style="”width:195px;height:15px;background:#0d0d1c;border:solid" 1px="">
<div class="”progress”" style="height:15px;background:#1e90ff;color:white;width:javascript:percent()%"><b>0</b>
</div></div>
Could someone show me where I am going wrong with this please?
And if it matters: My blog is a *.blogspot.com
Thanks