/    Sign up×
Community /Pin to ProfileBookmark

java help PLEASE!

k i need some help. im trying to help my teacher with a voting program for promking/queen for our school and we are having a problem with this java code
<script language=”javascript” type=”text/javascript”>

var count = 0;

function Checksubmit (e)
{
alert(‘you have ‘ + (3 – count) + ‘ votes left ‘);
if(e.checked == true)
{
count–;
e.checked = true;

}
else

{
count++;
e.checked = true;
}
if(count == 3)
document.form1.submit.disabled = false;
else
document.form1.submit.disabled = true;

}

</script>

any help is appreciated we need this as soon as possible
edit– sorry what we want is to take the alert out of the code. we have deleted it, commented it out and we cant think of anything else

thanx
herbd

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@fredmvJan 29.2004 — Welcome to the forums.

Taking that line out or commenting it out would get rid of it...
Copy linkTweet thisAlerts:
@herbdauthorJan 30.2004 — no commenting it out didnt work.

our code ended up a lil different,

<script language="javascript" type="text/javascript">

var count = *3*;

function Checksubmit (e)

{

*//*alert('you have ' + (3 - count) + ' votes left ');

if(e.checked == true)

{

count*++*;

e.checked = *false*;

}

else

{

count*--*;

e.checked = *true*;

}

if(count == *0*)

document.form1.submit.disabled = *true*;

else

document.form1.submit.disabled = *false*;

}

</script>


our coder mixed up the trues and falses, but the part that we didnt look at was where the var number started and ended, we were asking it to add a number to 0 and at the same time telling it to subtract from 3. so the counting on the alert was REALLY messed up, and then once it got to 3 wich it didnt because taking away from 0 wont get to 3, we wanted out sumbit button to become active.

thanx for you help
Copy linkTweet thisAlerts:
@fredmvJan 31.2004 — That's because you aren't using a valid comment. JavaScript supports C++-style ([font=courier]//[/font]) and C-style ([font=courier]/* */[/font]) comments. The one you're using right now simply isn't valid, which is why it isn't working. And what's with all those random asterisks? That would also prevent it from working...
Copy linkTweet thisAlerts:
@herbdauthorJan 31.2004 — i sorry the stuff between the ** is what we changed. lol

woulda helped if i told ya that :- thx for the help though
×

Success!

Help @herbd 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.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

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