/    Sign up×
Community /Pin to ProfileBookmark

how 2 call counter 2 have a limit

Hi…

im creating a football website and in order to register a person has to pick 11 players from premiership teams!
i want there to be a limit of 50 million for the 11 players! at the moment i have a counter which count how much each player adds up as they pick them..
now when they press submit button.. its goes to savadata.php which will check it and then insert it to database

any ideas how to check the counter and if over the 50 million to
not save it
say echo(“Over limit”)

i’ve tried all kinds of things and really stuck..

the code for my counter is

function updateTotalCost () {
var intTotal = 0
var currentCost = “”
var playerlist = “”
var playertext = “”
var playervalue = “”
for(var i=1; i<=11; i++) {

playerlist = eval(“document.all.player” + i)

playertext = playerlist.options[playerlist.selectedIndex].text

playervalue = playerlist.options[playerlist.selectedIndex].value

if (playervalue != 0) {
intBeg = playertext.lastIndexOf (“) “)
intEnd = playertext.lastIndexOf (“m”)
intTotal += (10 * playertext.substring(intBeg+1, intEnd))
}
}
if (intTotal <= 500) {document.all.total.innerHTML = “<font color=”yellow”><b>” + (intTotal / 10) + “</b></font>”;
document.all.overbudget.width = 0
document.all.overbudget.height = 0
}
else{
document.all.total.innerHTML = “<font color=”red”><b>” + (intTotal / 10) + “</b></font>”;
document.all.overbudget.width = 92
document.all.overbudget.height = 17
}
}
// –>
</SCRIPT>
<FONT face=schoolboy size=5><SPAN class=bodycopy>Team Details
<P></FONT></SPAN><FONT face=”MS Sans Serial”
size=4><SPAN class=bodycopy>Your Budget is €50m!
<P>Current Total = €<SPAN id=total

Any ideas??? this code is in my addauser page and then i want to check it in my savedata page??

help????

?

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @susi 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 5.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

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