+ Reply to Thread
Results 1 to 10 of 10

Thread: TAFE Student again - currency conversion

  1. #1
    goldy300's Avatar
    goldy300 is offline x10Hosting Member goldy300 is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Australia
    Posts
    33

    Question TAFE Student again - currency conversion

    Well, this time I've gotta create a web application that allows the user to enter in an amount in which is already in AUD and converts it to what ever I have listed in the drop down list when onClick. This one I'd document.write to another page.

    I wasn't sure about adding the value of what other currencies are to each var. Do I sort of have it? And I wasn't sure about assigning the "name" in the select list to a variable... is that like (document.form1.selectlist.name.value) ??
    or just document.form1.name.value

    Each exercise is different to what I've been helped with on the previous exercise.

    Here is my mess:

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> Currency Converter </TITLE>
    
    <script type="text/javascript">
    function calc()
    
    var usd, eur, gbp, nzd;
    var currency;            // thought I may have to add this var for the select list??
    
    var usd = (document.form1.usd.value);
    var eur = (document.form1.eur.value);
    var gbp = (document.form1.gbp.value);
    var nzd = (document.form1.nzd.value);
    
    var currency = (document.form1.currency.value);
    
    var usd = 1.39329; //not sure if these currencies are correct. xe has inverse and normal.. or what ever??
    var eur = 1.88496;
    var gbp = 2.41916; // multiply by AUD here??
    var nzd = ;
    
    
    
    // was going to doc.write here
    </script>
    
    </HEAD>
    
    <BODY>
    <center>
    <font face="arial" size="2">
    <form name="form1">
    Convert: <input type="text" name="amount" size="10" value="$0.00"> &nbsp; From AUD Australian Dollars into: &nbsp;
    
    <select name="currency">
        <option name="usd">USD United States Dollars</option>
        <option name="eur">EUR Euro</option>
        <option name="gbp">GBP United Kingdom Pounds</option>
        <option name="usd">NZD New Zealand Dollars</option>
    </select>
    &nbsp;
    <input type="button" name="convert" value="Go!" onClick="calc()">
    </form>
    </font>
    </center>
    </BODY>
    </HTML>
    Thanx guys!

  2. #2
    xmakina's Avatar
    xmakina is offline x10 Lieutenant xmakina is an unknown quantity at this point
    Join Date
    May 2008
    Location
    England
    Posts
    265

    Re: TAFE Student again - currency conversion

    Have you talked to your tutor? Have you done your own research? Why not ask fellow students? I know you've got access to an amout of help here, but why not use the resources you have to hand?

    Option tagss use value as well as name. You may benefit from putting the currency values in the option tag and then calc(this.currency.selected) (or whatever the javascript is).

    Also: look here for more info on <select> and JScript http://www.javascriptkit.com/jsref/select.shtml
    IF($this->$post.content() == "SEE SIG"){
    w3Schools and Google
    }

  3. #3
    dickey's Avatar
    dickey is offline x10 Sophmore dickey is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    128

    Re: TAFE Student again - currency conversion

    This is a simple task. And we would be glad to help. but in the end you stand to lose as you did not try to learn the concept behind. when you get stuck after carefully thinking of the logic of your solution, then we will help.

    coz I.T. is not about coding, it is more on ideas and solution finding. Be an IT manager not a program coder.

  4. #4
    goldy300's Avatar
    goldy300 is offline x10Hosting Member goldy300 is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Australia
    Posts
    33

    Question Re: TAFE Student again - currency conversion

    Why do I feel like I've pushed the envelope in a help forum? This is all brand new to me... I know some of the syntax but am still very vague on it as a whole. Also what I found on Google about javascript and currency conversion was actual currency converters such as xe.com and other people converters. I've look at the source code on a few but they're either too complex for how I want to do it, which doesn't help me understand if I don't know what it means... or javascript was an external file.

    I did actually have a go but felt like it needed something else. I'll look at the javascriptkit site and see and see if I can make sense of it there. thanks anyway.

  5. #5
    xmakina's Avatar
    xmakina is offline x10 Lieutenant xmakina is an unknown quantity at this point
    Join Date
    May 2008
    Location
    England
    Posts
    265

    Re: TAFE Student again - currency conversion

    Quote Originally Posted by goldy300 View Post
    Why do I feel like I've pushed the envelope in a help forum? This is all brand new to me...
    You answered your own question. You are Learning. You don't know this from that. This forum is for "Help". So when you understand the basics, things like objects, threads, the stack and the heap, paranthesis, functions, parameters, this, >, <, ||, &&, == and all the other fundamentals that your course is teaching you, then your questions will be of the level to ask here.

    We're here to help web designers debug scripts or come up with original ideas to new and interesting problems. Most of us have already done all these mundane school exercises, we don't want to do them again and they're what helped us learn.

    If we'd been spoon fed we wouldn't be able to help you when you actually need it and you won't be able to help us as you won't understand the Why, only the How.

    As said above, once you've tried then ask. Frankly, if you try and still need to ask here you should go talk to your tutor, not us, as they will understand the course and the one-to-one will be much more useful to you.
    IF($this->$post.content() == "SEE SIG"){
    w3Schools and Google
    }

  6. #6
    goldy30's Avatar
    goldy30 is offline x10Hosting Member goldy30 is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    60

    Thumbs down Re: TAFE Student again - currency conversion

    yeah ok... if I wasn't on holidays I'd be a TAFE to ask my teacher...

    You know with all that you just wrote, wouldn't have just been easier to say... Goldy, you only have to multiply the text input, which was "amount" with the select list's name. last guy gave me the hint that the values in each option hold the conversion rate and thats it.

    once I know it once, later I won't have to ask obviously stupid questions to people like you.

  7. #7
    dickey's Avatar
    dickey is offline x10 Sophmore dickey is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    128

    Re: TAFE Student again - currency conversion

    You sure are grateful.

  8. #8
    Jordan C's Avatar
    Jordan C is offline x10 Lieutenant Jordan C is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    New Zealand
    Posts
    425

    Re: TAFE Student again - currency conversion

    Hi.
    I hope this should help, I'm not very good at JavaScript, the number has to be whole, and the answer is in an alert.

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> Currency Converter </TITLE>
    
    <script type="text/javascript">
    function calc(){
    
    answer=document.form1.amount.value*document.form1.currency.value
    alert(answer)
    }
    
    </script>
    
    </HEAD>
    
    <BODY>
    <center>
    <font face="arial" size="2">
    <form name="form1">
    Convert: $<input type="text" name="amount" size="10" value=""> &nbsp; From AUD Australian Dollars into: &nbsp;
    
    <select name="currency">
        <option name="usd" value='0.664'>USD United States Dollars</option>
        <option name="eur" value='0.486'>EUR Euro</option>
        <option name="gbp" value='0.384'>GBP United Kingdom Pounds</option>
        <option name="usd" value='1.111'>NZD New Zealand Dollars</option>
    </select>
    &nbsp;
    <input type="button" name="convert" value="Convert" onClick="calc()">
    </form><p></p>
    
    </font>
    </center>
    </BODY>
    </HTML>
    Last edited by Jordan C; 10-09-2008 at 12:50 AM.


    Like Mac? Need Mac help? Thinking of switching? Smart Mac is the place for you!
    Join Smart Mac!


  9. #9
    goldy300's Avatar
    goldy300 is offline x10Hosting Member goldy300 is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Australia
    Posts
    33

    Re: TAFE Student again - currency conversion

    Quote Originally Posted by dickey View Post
    You sure are grateful.
    I am grateful! I post appreciation and thanks every time and those who do help me without criticism come out with some excellent advice. This other guy was basically telling me to go elsewhere and learn and come back when I've got a real problem, and not lame student exercises.

    Don't get me wrong though.. I appreciate all the advice everyone here has given me. Even your explanation about the regular expression dickey :happysad:

  10. #10
    scopey is offline x10Hosting Member scopey is an unknown quantity at this point
    Join Date
    May 2008
    Posts
    62

    Re: TAFE Student again - currency conversion

    If you want to try something a little more advanced, try using an XML for currency rates. Eg: http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
    - When in doubt, refer to the PHP manual.

+ Reply to Thread

Similar Threads

  1. Student - tafe designs
    By goldy300 in forum Review My Site
    Replies: 4
    Last Post: 10-11-2008, 06:46 PM
  2. TAFE STUDENT - PHP - Send mail - Verify feilds
    By goldy30 in forum Programming Help
    Replies: 7
    Last Post: 10-04-2008, 04:27 PM
  3. TAFE Student - Check my javascript.. line 31 int 40
    By goldy30 in forum Programming Help
    Replies: 4
    Last Post: 10-04-2008, 09:15 AM
  4. Tafe Student
    By goldy30 in forum Review My Site
    Replies: 4
    Last Post: 10-01-2008, 01:27 AM
  5. TAFE Student
    By goldy30 in forum Review My Site
    Replies: 7
    Last Post: 09-27-2008, 01:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers