/    Sign up×
Community /Pin to ProfileBookmark

"Real Time" Percentage or bar change

Hi everyone what i have built is a script that has 3 numbers at the top which increase in number with my specific speed and then stops at my specific point which is 250.(storehouse)

is there a real time stat thing where for example next to it it has a message like;

storehouse 56% full

or a bar that fills up to the top when it reaches the limit(250).

any help on this will be gratefully be appreciated.

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@mitchellauthorAug 22.2007 — my script
<html>

<head>

<script hex="53545544454E54204348454154454421">

var interval0 = setInterval("change(1,0,0);",4000);

var interval1 = setInterval("change(0,1,0);",3000);

var interval2 = setInterval("change(0,0,1);",2100);

function change(x,y,z)

{

var reduce = new Array(x,y,z);

var field = new Array(), count=3, canSubtract=false;

for (var i = 0; i < count && Number(document.getElementById("i"+i).value) + reduce[i] > -1; i++)

;



if(i==count)

{

for (i = 0; i < count; i++)

{

field[i] = document.getElementById("i"+i);



var temp = Number(field[i].value)+reduce[i];



if(temp >= 0 && temp <= 250) // only assign new value if 0 or greater and 20 or less

field[i].value = temp;

}

canSubtract=true;

}



return canSubtract;

}



function clear(x,y,z)

{

var inital = new Array(x,y,z);

for (i = 0; i < 3; i++) {

var a = document.getElementById("i"+i);

a.value = inital[i];

}

}



</script>

</head>





<body onload="clear(10,10,10);">





<form>

<img src="gold.jpg"><font color="#EAC117">Gold:</font><input type="text" value="10" id="i0" readonly />

<img src="lumber.gif"><font color="#7E3817">Lumber:</font><input type="text" value="10" id="i1" readonly />

<img src="stone.jpg"><font color="#736F6E">Stone:</font><input type="text" value="10" id="i2" readonly />

</form>



</body>



</html>
[/QUOTE]
Copy linkTweet thisAlerts:
@mitchellauthorAug 22.2007 — ive tryed having a IF 25> = 20% full

but it dosnt work, its a pretty dam hard script to do.
Copy linkTweet thisAlerts:
@KorAug 22.2007 — ...never heard about a [B]hex[/B] attribute for the <script> element. Should simply be
<i>
</i>&lt;script type="text/javascript"&gt;

And you should use a Doctype for your page, probably a HTML transitional or strict...
Copy linkTweet thisAlerts:
@TheBearMayAug 22.2007 — The hex translates to: STUDENT CHEATED!
Copy linkTweet thisAlerts:
@mitchellauthorAug 22.2007 — No no no, Arty Effem helped me with it and he said

theres a bug in Mozilla were multiple intervals should neither be equal or multiples of each other, otherwise they can be periodically missed.

so he did stuff to it such as the hex thing
Copy linkTweet thisAlerts:
@LeeUAug 22.2007 — No no no, Arty Effem helped me with it and he said

theres a bug in Mozilla were multiple intervals should neither be equal or multiples of each other, otherwise they can be periodically missed.

so he did stuff to it such as the hex thing[/QUOTE]

See http://www.webdeveloper.com/forum/showpost.php?p=793034&postcount=2
Copy linkTweet thisAlerts:
@mitchellauthorAug 22.2007 — so does no one have any info on "Real Time" Percentage or bar change.

thanks to anyone who as tried helping me but failed, lol
Copy linkTweet thisAlerts:
@KorAug 22.2007 — ok... now which is the variable to be changed in time (the element's value)? When should that happen (the user's action / event) ?
Copy linkTweet thisAlerts:
@mitchellauthorAug 22.2007 — well my script has 3 numbers which increase at a certain speed and stops at a certain point which is called "full"

i just wanted to know if anyone has any knowlege of how i could put a script next to it saying how much is left

eg

35% full

which updates in real time and so they know how full there "storehouse" is.
×

Success!

Help @mitchell spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...