/    Sign up×
Community /Pin to ProfileBookmark

Change text based on characters in box

[B]Here’s what I need:[/B]

1 textbox (t1)
1 textbox (t2)
1 textbox (t3)

t2 displays the number of characters in t1.

t3 displays an amount in the form of $x.xx or ‘Free’

[B]Simple enough right? Here’s the conditions:[/B]

If t2 <= 100, t3 displays ‘Free’. Otherwise t3 displays $x.xx where it increases by a penny for each character over 100.

[B]Example 1:[/B]

t1 -> aaaaaaaaaaaaaa
t2 -> 14
t3 -> Free

[B]Example 2:[/B]

t1 -> aa…aa (150 a’s)
t2 -> 150
t3 -> $0.50

Thanks for any help you can give!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMar 11.2006 — This seems like a school assignment. Is it? If so, then if you don't understand how to do your school assignments, you should be asking your teacher for this kind of help. You will benefit in the long run.

If not an assignment, then post some JavaScript and HTML code to show what you're working on. Thanks.
Copy linkTweet thisAlerts:
@soccer022483authorMar 11.2006 — No it's not a school project, just a personal ad system i'm trying to make. I think I may have figured it out, I'll repost if I have any questions.
Copy linkTweet thisAlerts:
@phpnoviceMar 11.2006 — OK, then I'll just point out that the [b]onkeyup[/b] event is the best for just counting characters in a text box/area as they are typed.
×

Success!

Help @soccer022483 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.17,
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,
)...