/    Sign up×
Community /Pin to ProfileBookmark

Database type thing

I want to know how i would like make a thing where you have numbers like 029874987987 and enter them into a form and then it will bring up a alert window and says a word like PEPSI or something ?

what i want


______________________________

like uh mabee like where it has A=pepsi and then it says if form 1(the text bar thing where you type) equals 456654 then put A in the alert box. In that format but i dont know how to do it becase im not that good with javascript yet

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@toicontienSep 13.2006 — You'll have to give us more information on what you want. The description is way too broad. There are a myriad of ways to accomplish this.
Copy linkTweet thisAlerts:
@gamecube998authorSep 13.2006 — Well im not too good at this but i did make one javascript before.

im not really sure how to approach it or anything but like mabee with variables and stuff and if than staement if you need that i dont really know lol
Copy linkTweet thisAlerts:
@gamecube998authorSep 13.2006 — see like this http://www.freewebs.com/gcn998/mkdscalculator.htm where it just pops up and says PEPSI or watever i make it say when i edit and add more numbers.
Copy linkTweet thisAlerts:
@gamecube998authorSep 14.2006 — like uh mabee like where it has A=pepsi and then it says if form 1(the text bar thing where you type) equals 456654 then put A in the alert box. In that format but i dont know how to do it becase im not that good with javascript yet ? it can be in any code i dont really care just something... i just dont know how to make this...
Copy linkTweet thisAlerts:
@toicontienSep 14.2006 — Hm. I think I know what you mean now. Try this then maybe:
[code=html]
<form id="myform" action="#" method="get" onsubmit="return checkNumber(this);">
<p>
<label for="mynumber">
Enter a number:
<input type="text" id="mynumber" name="mynumber" value="">
</label>
<input type="submit" value="Go">
</p>
</form>
<script type="text/javascript">
<!--
function checkNumber(form) {
if (form.mynumber.value === '1234') {
alert('Pepsi');
}
return false;
}
// -->
</script>
[/code]
Copy linkTweet thisAlerts:
@gamecube998authorSep 14.2006 — THANKS A TON this is exactly what i wanted ?
×

Success!

Help @gamecube998 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.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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