View Full Version : currency converter: USD - CAD
Ricky158
09-17-2002, 12:27 AM
i need a script that will somehow ask the person how much USD/CAD they want to convert, and then click Go (button) and then a pop up comes up with the converted amount.
1 USD = 1.58078 CAD
if anyone is wondering (which i doubt) USD is US dollars, and CAD is Canadian Dollars.
if there is any more info that you need, please ask.
thanks so much!
Gordo
09-17-2002, 01:15 AM
Don't have the time to find the right answer...plus, I don't know if you want a free service, just JavaScript, or what...
Anyway...check out this Google search (http://www.google.com/search?as_q=javascript+convert+US+dollars+canadian+CAD&num=30&hl=en&ie=UTF-8&oe=UTF-8&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=lang_en&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=&safe=images). You might find something of use there.
Good luck...
Ricky158
09-17-2002, 02:02 AM
i want javascript. isnt there a mathematical thing that could be written? i know what i want, but i dont know how to do it...
like for USD to CAD, it should be based on USD=x, CAD=y. x=1, y=1.58078. then you change the value of x (it is currently 1) in a textarea, and then click Go (button). then an alert comes up with the value of y, if x = (whatever the person entered).
like i said, i know what i want, but i dont know how to get it in JavaScript.
thanks, gordo, but all of the links i tried there were just to use a converter on their site, and the converter had a lot more currencies in it too, which are unneccesary for me.
anyone know how to make it?
boywonder
09-17-2002, 02:44 AM
You mean this? or am I missing something...
<form>
<input type="text" name="USamt">
<input type="button" value="US to CD" onclick="alert(this.form.USamt.value*1.58078);">
<br>
<input type="text" name="CDamt">
<input type="button" value="CD to US" onclick="alert(this.form.CDamt.value/1.58078);">
</form>
Ricky158
09-17-2002, 04:39 AM
yes, :p, that looks like a very simple code for something that has stumped me for days. hehe. is there a way to round the amount so instead of "3.348204..." it will say "3.35"??? also, how can i make the textbox thinner? like, only have it about 5 characters wide. maybe i'm aking for too much. but what you gave me, boywonder, will do just fine for now.
THANKS!
boywonder
09-17-2002, 01:52 PM
cool.:thumbsup:
how's this...
<form>
<input type="text" name="USamt" size="5">
<input type="button" value="US to CD" onclick="alert(Math.round((this.form.USamt.value*1.58078)*100)/100);">
<br>
<input type="text" name="CDamt" size="5">
<input type="button" value="CD to US" onclick="alert(Math.round((this.form.CDamt.value/1.58078)*100)/100);">
</form>
Ricky158
09-17-2002, 08:36 PM
EVEN BETTER! :D
thanks a lot, boywonder, that's perfect.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.