Thread: Need help...stuck!!!
Results 1 to 4 of 4
Related
-
Stuck in CSS! Forum: CSS Forum
Replies: 3 -
Stuck on mySQL! Forum: Databases
Replies: 5 -
I'm stuck on my website- regarding MP3 downloads Forum: General Discussion
Replies: 2
-
01-14-2003, 10:02 AM #1
Need help...stuck!!!
I have implemented a document and added a form to it so that i can convert an amount of money between British pounds and US dollars.
I am trying to extend the above to charage a commission of 5% of the value of the amount changed in the currency that the money is being changed from.
Im really stuck can someone help...thanx
-
01-14-2003, 11:25 AM #2
-
01-14-2003, 11:38 AM #3
This is the code...
<html>
<head>
<title>currency converter</title>
<script language="javascript">
<!--
var exchRate = 1.6; // constant
function calc(form){
var usdValue = form.USD.value;
var gbpValue = form.GBP.value;
//strip dollar or pound signs:
if (usdValue.substring(0,1) == '$') {
usdValue = form.USD.value = usdValue.substring(1);
}
if ((gbpValue.substring(0,1) == '#') or (gbpValue.substring(0.1) == "£")) {
gbpValue = form.GBP.value = gbpValue.substring(1);
}
if (Number(usdValue)) {
// a number has been typed in the USD field
form.GBP.value = ( Number(form.USD.value)/exchRate);
return;
}
if (Number(gbpValue)){
// a number has been typed in the GBP field
form.USD.value = (Number(form.GBP.value)*exchRate);
return;
}
}
//-->
</head>
</script>
<body>
<form name="tool">
Enter Currency to convert in desired field:
<br>
USD ($): <input type="text" size=8 name="USD">
<br>
GBP (£): <input type="text" size=8 name="GBP">
<br>
<input type="button" value="calculate" onclick="calc(this.form)">
<br>
<input type="reset" value="reset">
</form>
</body>
</html>
-
01-14-2003, 01:58 PM #4
Is the charge added on to the total, or deducted the the returned value?
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum