topical media & game development
lib-js-math-calculator-euro.htm / htm
<!-- TWO STEPS TO INSTALL EURO CONVERTER:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Mike McGrath (mike_mcgrath@lineone.net) -->
<!-- Web Site: http://website.lineone.net/~mike_mcgrath -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var rate, index;
function locate(f,member,curr,r) {
f.country.value=member;
f.currency.value=curr;
f.euro1.value=1;
rate=r;
toLocal(f);
}
function toLocal(f) {
if (f.euro1.value != "") {
f.local1.value = eval(f.euro1.value * rate);
if (f.euro1.value != "1") {
f.local1.value=eval(Math.round(f.local1.value * 100)) / 100;
f.local1.value=format(f.local1.value);
}
}
}
function toEuro(f) {
if (f.local2.value != "") {
f.euro2.value = eval(f.local2.value / rate);
if (f.local2.value != "1") {
f.euro2.value=eval(Math.round(f.euro2.value * 100)) / 100;
f.euro2.value=format(f.euro2.value);
}
}
}
function format(str) {
index = str.indexOf(".");
if (index < 0) str = str + ".00";
else {
str = str.substring(0, index + 3);
if (str.length < (index + 3)) str += "0";
}
return str;
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<center>
<form name="euroform">
<table border=1 cellpadding=3 cellspacing=0>
<td align=center colspan=6>Euro Converter</td>
<tr>
<td align=center>
<input type=button value="ATS" onClick="locate(this.form,'Austria','Schilling',13.7603)">
</td>
<td align=center>
<input type=button value="BEF" onClick="locate(this.form,'Belgium','Franc',40.3399)">
</td>
<td align=center>
<input type=button value="DEM" onClick="locate(this.form,'Germany','Mark',1.95583)">
</td>
<td align=center>
<input type=button value="ESP" onClick="locate(this.form,'Spain','Peseta',166.386)">
</td>
<td align=center>
<input type=button value="FRF" onClick="locate(this.form,'France','Franc',6.55957)">
</td>
<td align=center>
<input type=button value="IEP " onClick="locate(this.form,'Ireland','Pound',0.787564)">
</td>
</tr>
<tr>
<td align=center>
<input type=button value=" ITL " onClick="locate(this.form,'Italy','Lira',1936.27)">
</td>
<td align=center>
<input type=button value="NLG" onClick="locate(this.form,'Holland','Guilder',2.20371)">
</td>
<td align=center>
<input type=button value="LUF" onClick="locate(this.form,'Luxembourg','Franc',40.3399)">
</td>
<td align=center>
<input type=button value="PTE" onClick="locate(this.form,'Portugal','Escudo',200.482)">
</td>
<td align=center>
<input type=button value="FIM " onClick="locate(this.form,'Finland','Mark',5.94573)">
</td>
<td align=center>
<input type=reset value="Reset">
</td>
</tr>
<tr>
<td colspan=6 align=center>
Country: <INPUT NAME="country" SIZE=8>
Currency: <INPUT NAME="currency" SIZE=8>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input name="euro1" size=8> Euro
</td>
<td colspan=2 align=center>
<input type=button value="equals" onClick="toLocal(this.form)">
</td>
<td colspan=2 align=center>
<input name="local1" size=8> Local
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input name="local2" size=8> Local
</td>
<td colspan=2 align=center>
<input type=button value="equals" onClick="toEuro(this.form)">
</td>
<td colspan=2 align=center>
<input name="euro2" SIZE=8> Euro
</td>
</tr>
</table>
</form>
</center>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 3.63 KB -->
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.