473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

a novice with html could use a little help !!!!

2
Hey guys I was wondering if anyone knew how to create a currency converter using html programming, here are the guidelines I am looking for :


Develop an HTML/JavaScript program that creates a web page that can be used as a GUI to convert U.S. currency to Canadian dollars, British Pound, or Euro. The conversion formulas are:

1 US $ = 0.974 Canadian Dollar
1 US $ = 0.492 British Pound
1 US $ = 0.706 Euro

program should be able to convert values of $100 million or more.


Thanks for all the help I really appreciate it
Apr 1 '08 #1
2 1001
ajs05
2
Hey guys I was wondering if anyone knew how to create a currency converter using html programming, here are the guidelines I am looking for :


Develop an HTML/JavaScript program that creates a web page that can be used as a GUI to convert U.S. currency to Canadian dollars, British Pound, or Euro. The conversion formulas are:

1 US $ = 0.974 Canadian Dollar
1 US $ = 0.492 British Pound
1 US $ = 0.706 Euro

program should be able to convert values of $100 million or more.


Thanks for all the help I really appreciate it


here is what I have so far


[HTML]<!Currency Converter-->
<Html>
<head>
<title> Currency Converter</title>
<script language="javascript">
function convert(){
if (document.conversions.choice[0].checked){
var result= eval(document.conversions.degree.value*1=0.974);
document.conversions.convertedvalue.value=result;
var inputunit= "US Dollar";
document.conversions.inUnit.value= inputUnit;
var outputUnit="Canadian Dollar";
document.conversions.outUnit.value=outputUnit;
}//end if

<Body background="blue">
<form name = "Conversions">
<table border=6bgcolor="red">
<tr>
<td><font color="black"size=6>Enter Us dollar amount;</font>
<td><input type="text" name= "Dollar" size=4>
<td><input type="text" name= "Inunit" size= 20>
</tr>[/HTML]
Apr 1 '08 #2
pronerd
392 Expert 256MB
Please try to use code tags when including code. I makes it much easier to read.

A couple of issues I see.

1. The convert function does not seem to ever be called any where. What is supposed to trigger that function?

2. There is an IF test checking the checked attribute, but I do not see a check box in your code? Is there HTML that was not included? If not it is never going to get passed that test.

3. There is JavaScript accessing an input tag named outUnit, but I do not see that field anywhere in the HTML.

4. It is usually faster and more reliable to refernce tags by their ID attribute rather than using them DOM tree path.

So to access :

[HTML]<input type="text" id="dallor" name= "Dollar" size=4>[/HTML]

It would be better to do this.

Expand|Select|Wrap|Line Numbers
  1. document.getElementIdBy('dallor');
Apr 1 '08 #3

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.