wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Help with this code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Help with this code" Watch "Help with this code" New topic
Author

Help with this code

Rajpal Kandhari
Ranch Hand

Joined: Aug 26, 2000
Posts: 126
Hello Friends,
Well for a change i was was working on making a money converter. As usual i got this Idea from one of the web site and i was working on it to see if i could make it or not. I have used servlet and JDBC. After the servlet is invoked by the server, it fetches the data from the database and send it to the cliend machine. And the conversion calculation is done on the client machine using javascript....which confirm whether the given entery is a number, formats the number and exchange rate to 6 decimal places and performs the calculations. For exchange rate i have takes US $ as base and all the currency is equavalent to 1.00 US$.

This is first time I am using javascript with servlets. Until now i only used to use javascript for form creation i.e. registration form, posting a new topic form. In that case my page used to be in HTMl alone. Here is this example i have combined javascript, html, servlet, jdbc.
I would like to know if this method of writting code is correct? Is their is a better way in which i can write my code...if i have to uses javascript, html, servlets, jdbc?

Second pb it that i am not able to make this code work. I am getting the HTMl from the server but complied with error. That is on status line i am getting message "Done Error on page". Can anyone pls go through it and see where the pb is.
I have tried working o this code for 6 hours but no luck. I would really appreciate if somebody tell me weak points of my code writting and suggestion for improvement in writting similar code.

Thanks ,
regards
Raj.
===============================================================================================
import java.sql.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Currency extends HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {

// setting the responce type
res.setContentType("text/html");
PrintWriter pw = res.getWriter();
//writting the javascript code and writting functions
pw.println("<html>\n<head>\n <title>Currency Convertor</title>\n");
pw.println("<script language = javascript>\n ");
//This function whether the given entry is a valid number or not
pw.println("function checkNum(str) {");
pw.println("if (str.indexOf(\".\") != str.lastIndexOf(\".\")) {");
pw.println("alert(\"Please enter number only ! \");");
pw.println("return(false); \n } ");
pw.println("for(var i =0; i <length.str; i++ ) {");
pw.println("var ch = str.substring(i, i+1);");
pw.println("if ( (ch<\"0\" | | ch > \"9\") && (ch != \".\") && (ch != \"-\") ) {");
pw.println("alert(\"Please enter number only !\");");
pw.println("return(false); \n } \n }");
pw.println("return(true); \n }");
//This function format the number in the specified format i.e upto 6 decimal places
pw.println("function formatNumber(num) {");
pw.println("num = \"\" + num;");
pw.println("if (num.indexOf(\".\")==0) { ");
pw.println("num=\"0\"+num; \n }");
pw.println("if (num.indexOf(\".\") == -1) {");
pw.println("num=num+\".0\"; \n } ");
pw.println("num = num + \"000000\";");
pw.println("return(num.substring(0, num.indexOf(\".\")+6)); \n }");
//This function claculates the Exchange rate from the two given exchange rate compared to US$
pw.println("function calcFxRate(rate1, rate2) { ");
pw.println("if ((rate1 == -1) | | (rate2 == -1)) {");
pw.println("return(-1); \n }");
pw.println("else {");
pw.println("return(formatNumber(rate1/rate2)); \n } \n }");
//This function calculate the result amount based on the amount and the exchange rate //calculated
pw.println("function calcForm (form) {");
pw.println("if ( checkNum(form.Amount.value) && checkNum(form.ExRate.value) && (form.Amount.value >= 0) && (form.ExRate.value >= 0) { ");
pw.println("form.Result.value = FormatNumber(form.Amount.value * form.ExRate.value); \n }");
pw.println("else { ");
pw.println("form.ExRtae.value = \"NA\";");
pw.println("form.Result.value = \"NA\"; \n }");
pw.println("return(form); \n }");
pw.println("</script> \n </head>");
//end of javascript and the head portion

//Begining of the Body part
pw.println(" <body>\n <center><font face=verdana > \n \n");
pw.println("<h2 >Currency Converter</h2>\n<br>");
pw.println("<h3>I want to convert...</h3>\n<br></font>\n");
pw.println("<form><table> \n ");
pw.println("<tr align=middle valign=top bgcolor=grey><center><b>this amount</b><br>");
pw.println("<input type=text name=Amount value=1 size=20 onchage=\"CalcForm(this.form)\">"+
" </center></tr> <tr align=center bgcolor=lightgreen> <td><b>from this currency</b><br>");

Connection conn = null;
Statement st = null;
ResultSet rs = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc dbc:Travel"," ", " ");
st = conn.createStatement();
//Defining query statement that we will use to retrive data from database
String query1 = "SELECT CurrencyFrom,value FROM Travel.Currency";
String query2 = "SELECT CurrencyTo,value FROM Travel.Currency";
rs = st.executeQuery(query1);

//making a select drop down box with size=1(default)
pw.println("<select name=From onChange=\"FxRate.value=calcFxRate(To.options[To.options.selectedIndex].value, this.options[selectedIndex].value); calcForm(this.form);\" > ");
while (rs.next()) {
pw.println("<OPTION value= "+rs.getString("value")+ ">"+rs.getString("CurrencyFrom")+"</OPTION>\n");
} // end of while loop
pw.println("</select>\n</td>\n");
//retriving other data and making another drop down box
rs = st.executeQuery(query2);
pw.println(" <td><b>to this currency</b><br>\n");
pw.println("<select name=To onChange=\"FxRate.value=calcFxRate(this.option[selectedIndex].value, From.options[From.options.selectedIndex].value); calcForm(this.form);\" > ");
while (rs.next()) {
pw.println("<OPTION value= "+rs.getString("value")+ ">"+rs.getString("CurrencyTo")+"</OPTION>\n");
} // end of while loop
pw.println("</select>\n</td>\n</tr>\n");
// creating text boxes for display of exchange rate and result amount
pw.println("<tr align = center bgcolor=grey><td><b>Exchange Rate</b><br>");
pw.println("<input type=text name = FxRate onChange=\"calcForm(this.form) value=1.00 \"></td>");
pw.println("<td><b>Result Amount</b><br>");
pw.println("<input type=text name=Result onChange=\"Amount.value=formatNumber(calcFxRate(this.value,FxRate.value))\"></td></tr><br><br>");
// creating two button one is for calculation other is to reset values to default.
pw.println("<tr align=middle><td>");
pw.println("<input onClick=\"calcForm(this.form)\" type=button value=Convert> </td>");
pw.println("<td><input type=reset name=Reset value=Reset></td> </tr>");
pw.println("</table>\n<form>\n </body>\n </html>");
pw.close();
}
catch( Exception e) {
System.out.println(e.getMessage());
}

}
public void destroy() {
}
}
=================================================================================================
This is the source code as viewed from Browser View Source option:
<html>
<head>
<title>Currency Convertor</title>
<script language = javascript>

function checkNum(str) {
if (str.indexOf(".") != str.lastIndexOf(".")) {
alert("Please enter number only ! ");
return(false);
}
for(var i =0; i <length.str; i++ ) {
var ch = str.substring(i, i+1);
if ( (ch<"0" | | ch > "9") && (ch != ".") && (ch != "-") ) {
alert("Please enter number only !");
return(false);
}
}
return(true);
}
function formatNumber(num) {
num = "" + num;
if (num.indexOf(".")==0) {
num="0"+num;
}
if (num.indexOf(".") == -1) {
num=num+".0";
}
num = num + "000000";
return(num.substring(0, num.indexOf(".")+6));
}
function calcFxRate(rate1, rate2) {
if ((rate1 == -1) | | (rate2 == -1)) {
return(-1);
}
else {
return(formatNumber(rate1/rate2));
}
}
function calcForm (form) {
if ( checkNum(form.Amount.value) && checkNum(form.ExRate.value) && (form.Amount.value >= 0) && (form.ExRate.value >= 0) {
form.Result.value = FormatNumber(form.Amount.value * form.ExRate.value);
}
else {
form.ExRtae.value = "NA";
form.Result.value = "NA";
}
return(form);
}
</script>
</head>
<body>
<center><font face=verdana >

<h2 >Currency Converter</h2>
<br>
<h3>I want to convert...</h3>
<br></font>
<form><table>

<tr align=middle valign=top bgcolor=grey><center><b>this amount</b><br>
<input type=text name=Amount value=1 size=20 onchage="CalcForm(this.form)"> </center></tr> <tr align=center bgcolor=lightgreen> <td><b>from this currency</b><br>
<select name=From onChange="FxRate.value=calcFxRate(To.options[To.options.selectedIndex].value, this.options[selectedIndex].value); calcForm(this.form);" >
<OPTION value= -1.0>AED U.A.E. dirham</OPTION>
<OPTION value= 15.813784>ATS Austrian schillings</OPTION>
<OPTION value= 1.87919>AUD Australian dollar</OPTION>
<OPTION value= -1.0>BDT Bangladesh taka</OPTION>
<OPTION value= 46.359924>BEF Belgian franc</OPTION>
<OPTION value= -1.0>BHD Bahraini dinar</OPTION>
<OPTION value= 1.8558>BRL Brazil real</OPTION>
<OPTION value= 1.5014>CAD Canadian dollar</OPTION>
<OPTION value= 1.74715>CHF Swiss franc</OPTION>
<OPTION value= 8.2789>CNY China renminbi</OPTION>
<OPTION value= -1.0>COP Colombian peso</OPTION>
<OPTION value= -1.0>CYP Cyprus pound</OPTION>
<OPTION value= 2.247703>DEN German mark</OPTION>
<OPTION value= 8.5546>DKK Danish krone</OPTION>
<OPTION value= 191.216199>ESP Spanish peseta</OPTION>
<OPTION value= 1.149233>EUR Euro</OPTION>
<OPTION value= 6.833026>FIM Finnish markka</OPTION>
<OPTION value= 7.538471>FRF French franc</OPTION>
<OPTION value= 0.688568>GBP British Pound</OPTION>
<OPTION value= 390.8>GRD Greek drachma</OPTION>
<OPTION value= 7.797>HKD Hong Kong dollar</OPTION>
<OPTION value= 0.905094>IEP Irish punt</OPTION>
<OPTION value= 46.19>INR Indian rupee</OPTION>
<OPTION value= -1.0>IQD Iraqi dinar</OPTION>
<OPTION value= -1.0>IRR Iranian rial</OPTION>
<OPTION value= 83.62>ISK Iceland krona</OPTION>
<OPTION value= 2225.224413>ITL Italian lira</OPTION>
<OPTION value= 108.2>JPY Japanese yen</OPTION>
<OPTION value= 1121.9>KRW Korean won</OPTION>
<OPTION value= 0.3076>KWD Kuwaiti dinar</OPTION>
<OPTION value= 78.32>LKR Sri Lankan rupee</OPTION>
<OPTION value= 0.455415>MTL Maltese lira</OPTION>
<OPTION value= 9.465>MXP Mexican peso</OPTION>
<OPTION value= 3.8>MYR Malaysian ringgit</OPTION>
<OPTION value= 2.532575>NLG Dutch guilder</OPTION>
<OPTION value= 9.2536>NOK Norwegian krone</OPTION>
<OPTION value= -1.0>NPR Nepal rupee</OPTION>
<OPTION value= -1.0>NZD New Zealand dollar</OPTION>
<OPTION value= -1.0>OMR Omani rial</OPTION>
<OPTION value= -1.0>PKR Pakistani rupee</OPTION>
<OPTION value= 230.40043>PTE Portuguese escudo</OPTION>
<OPTION value= -1.0>QAR Qatari riyal</OPTION>
<OPTION value= -1.0>SAR Saudi riyal</OPTION>
<OPTION value= 9.8845>SEK Swedish krona</OPTION>
<OPTION value= 1.75115>SGD Singapore dollar</OPTION>
<OPTION value= 42.86>THB Thai baht</OPTION>
<OPTION value= 6.2726>TTD Trinidad & Tobago dollar</OPTION>
<OPTION value= 31.31>TWS Twaiwan dollar</OPTION>
<OPTION value= 1.0>USD U.S. dollar</OPTION>
<OPTION value= 692.2>VEB Venezuelan bolivar</OPTION>
<OPTION value= 7.37>ZAL South Africa rand</OPTION>
</select>
</td>
<td><b>to this currency</b><br>
<select name=To onChange="FxRate.value=calcFxRate(this.option[selectedIndex].value, From.options[From.options.selectedIndex].value); calcForm(this.form);" >
<OPTION value= -1.0>AED U.A.E. dirham</OPTION>
<OPTION value= 15.813784>ATS Austrian schillings</OPTION>
<OPTION value= 1.87919>AUD Australian dollar</OPTION>
<OPTION value= -1.0>BDT Bangladesh taka</OPTION>
<OPTION value= 46.359924>BEF Belgian franc</OPTION>
<OPTION value= -1.0>BHD Bahraini dinar</OPTION>
<OPTION value= 1.8558>BRL Brazil real</OPTION>
<OPTION value= 1.5014>CAD Canadian dollar</OPTION>
<OPTION value= 1.74715>CHF Swiss franc</OPTION>
<OPTION value= 8.2789>CNY China renminbi</OPTION>
<OPTION value= -1.0>COP Colombian peso</OPTION>
<OPTION value= -1.0>CYP Cyprus pound</OPTION>
<OPTION value= 2.247703>DEN German mark</OPTION>
<OPTION value= 8.5546>DKK Danish krone</OPTION>
<OPTION value= 191.216199>ESP Spanish peseta</OPTION>
<OPTION value= 1.149233>EUR Euro</OPTION>
<OPTION value= 6.833026>FIM Finnish markka</OPTION>
<OPTION value= 7.538471>FRF French franc</OPTION>
<OPTION value= 0.688568>GBP British Pound</OPTION>
<OPTION value= 390.8>GRD Greek drachma</OPTION>
<OPTION value= 7.797>HKD Hong Kong dollar</OPTION>
<OPTION value= 0.905094>IEP Irish punt</OPTION>
<OPTION value= 46.19>INR Indian rupee</OPTION>
<OPTION value= -1.0>IQD Iraqi dinar</OPTION>
<OPTION value= -1.0>IRR Iranian rial</OPTION>
<OPTION value= 83.62>ISK Iceland krona</OPTION>
<OPTION value= 2225.224413>ITL Italian lira</OPTION>
<OPTION value= 108.2>JPY Japanese yen</OPTION>
<OPTION value= 1121.9>KRW Korean won</OPTION>
<OPTION value= 0.3076>KWD Kuwaiti dinar</OPTION>
<OPTION value= 78.32>LKR Sri Lankan rupee</OPTION>
<OPTION value= 0.455415>MTL Maltese lira</OPTION>
<OPTION value= 9.465>MXP Mexican peso</OPTION>
<OPTION value= 3.8>MYR Malaysian ringgit</OPTION>
<OPTION value= 2.532575>NLG Dutch guilder</OPTION>
<OPTION value= 9.2536>NOK Norwegian krone</OPTION>
<OPTION value= -1.0>NPR Nepal rupee</OPTION>
<OPTION value= -1.0>NZD New Zealand dollar</OPTION>
<OPTION value= -1.0>OMR Omani rial</OPTION>
<OPTION value= -1.0>PKR Pakistani rupee</OPTION>
<OPTION value= 230.40043>PTE Portuguese escudo</OPTION>
<OPTION value= -1.0>QAR Qatari riyal</OPTION>
<OPTION value= -1.0>SAR Saudi riyal</OPTION>
<OPTION value= 9.8845>SEK Swedish krona</OPTION>
<OPTION value= 1.75115>SGD Singapore dollar</OPTION>
<OPTION value= 42.86>THB Thai baht</OPTION>
<OPTION value= 6.2726>TTD Trinidad & Tobago dollar</OPTION>
<OPTION value= 31.31>TWS Twaiwan dollar</OPTION>
<OPTION value= 1.0>USD U.S. dollar</OPTION>
<OPTION value= 692.2>VEB Venezuelan bolivar</OPTION>
<OPTION value= 7.37>ZAL South Africa rand</OPTION>
</select>
</td>
</tr>
<tr align = center bgcolor=grey><td><b>Exchange Rate</b><br>
<input type=text name = FxRate onChange="calcForm(this.form) value=1.00 "></td>
<td><b>Result Amount</b><br>
<input type=text name=Result onChange="Amount.value=formatNumber(calcFxRate(this.value,FxRate.value))"></td></tr><br><br>
<tr align=middle><td>
<input onClick="calcForm(this.form)" type=button value=Convert> </td>
<td><input type=reset name=Reset value=Reset></td> </tr>
</table>
<form>
</body>
</html>
================================================================================================
I have made a Travel database in MS-Access. It has a table name "Currency" with following table description:
CurrencyFrom Text(75)
CurrencyToText(75)
value Number Double(Decimal Place = 10)


Regards,<P>Raj.<BR>-------------------------<BR>Afforts should be Appriciated.<BR>-------------------------
S Chandra Mohan
Ranch Hand

Joined: Oct 19, 2000
Posts: 75
hai rajpal
the corrected code is

<html>
<head>
<title>Currency Convertor</title>
<script language="javascript">
function checkNum(str) {
if (str.indexOf(".") != str.lastIndexOf(".")) {
alert("Please enter number only ! ");
return false;
}
for(var i =0; i <length.str; i++ ) {
var ch = str.substring(i, i+1);
if ( (ch<"0" | | ch > "9") && (ch != ".") && (ch != "-") ) {
alert("Please enter number only !");
return false;
}
}
return true;
}
function formatNumber(num) {
num = "" + num;
if (num.indexOf(".")==0) {
num="0"+num;
}
if (num.indexOf(".") == -1) {
num=num+".0";
}
num = num + "000000";
return(num.substring(0, num.indexOf(".")+6));
}
function calcFxRate(rate1, rate2) {
if ((rate1 == -1) | | (rate2 == -1)) {
return(-1);
}
else {
return(formatNumber(rate1/rate2));
}
}
function calcForm (form) {
if ( checkNum(form.Amount.value) && checkNum(form.FxRate.value) && (form.Amount.value >= 0) && (form.FxRate.value >= 0)) {
form.Result.value = FormatNumber(form.Amount.value * form.FxRate.value);
}
else {
form.ExRtae.value = "NA";
form.Result.value = "NA";
}
return(form);
}
</script>
</head>
<body>
<font face="verdana">
<h2 align="center">Currency Converter</h2>
<p align="center"><br>
</p>
<h3 align="center">I want to convert...</h3>
<p align="center"><br>
</font></p>
<form>
<table>
<tr align="middle" valign="top" bgcolor="grey">
<b><td align="center">this amount</b><br>
<input type="text" name="Amount" value="1" size="20" onchage="CalcForm(this.form)"> </td>
</tr>
<tr align="center" bgcolor="lightgreen">
<td><b>from this currency</b><br>
<select name="From"
onChange="FxRate.value=calcFxRate(To.options[To.options.selectedIndex].value, this.options[selectedIndex].value); calcForm(this.form);"
size="1">
<option value="-1.0">AED U.A.E. dirham</option>
<option value="15.813784">ATS Austrian schillings</option>
<option value="1.87919">AUD Australian dollar</option>
<option value="-1.0">BDT Bangladesh taka</option>
<option value="46.359924">BEF Belgian franc</option>
<option value="-1.0">BHD Bahraini dinar</option>
<option value="1.8558">BRL Brazil real</option>
<option value="1.5014">CAD Canadian dollar</option>
<option value="1.74715">CHF Swiss franc</option>
<option value="8.2789">CNY China renminbi</option>
<option value="-1.0">COP Colombian peso</option>
<option value="-1.0">CYP Cyprus pound</option>
<option value="2.247703">DEN German mark</option>
<option value="8.5546">DKK Danish krone</option>
<option value="191.216199">ESP Spanish peseta</option>
<option value="1.149233">EUR Euro</option>
<option value="6.833026">FIM Finnish markka</option>
<option value="7.538471">FRF French franc</option>
<option value="0.688568">GBP British Pound</option>
<option value="390.8">GRD Greek drachma</option>
<option value="7.797">HKD Hong Kong dollar</option>
<option value="0.905094">IEP Irish punt</option>
<option value="46.19">INR Indian rupee</option>
<option value="-1.0">IQD Iraqi dinar</option>
<option value="-1.0">IRR Iranian rial</option>
<option value="83.62">ISK Iceland krona</option>
<option value="2225.224413">ITL Italian lira</option>
<option value="108.2">JPY Japanese yen</option>
<option value="1121.9">KRW Korean won</option>
<option value="0.3076">KWD Kuwaiti dinar</option>
<option value="78.32">LKR Sri Lankan rupee</option>
<option value="0.455415">MTL Maltese lira</option>
<option value="9.465">MXP Mexican peso</option>
<option value="3.8">MYR Malaysian ringgit</option>
<option value="2.532575">NLG Dutch guilder</option>
<option value="9.2536">NOK Norwegian krone</option>
<option value="-1.0">NPR Nepal rupee</option>
<option value="-1.0">NZD New Zealand dollar</option>
<option value="-1.0">OMR Omani rial</option>
<option value="-1.0">PKR Pakistani rupee</option>
<option value="230.40043">PTE Portuguese escudo</option>
<option value="-1.0">QAR Qatari riyal</option>
<option value="-1.0">SAR Saudi riyal</option>
<option value="9.8845">SEK Swedish krona</option>
<option value="1.75115">SGD Singapore dollar</option>
<option value="42.86">THB Thai baht</option>
<option value="6.2726">TTD Trinidad & Tobago dollar</option>
<option value="31.31">TWS Twaiwan dollar</option>
<option value="1.0">USD U.S. dollar</option>
<option value="692.2">VEB Venezuelan bolivar</option>
<option value="7.37">ZAL South Africa rand</option>
</select> </td>
<td><b>to this currency</b><br>
<select name="To"
onChange="FxRate.value=calcFxRate(this.option[selectedIndex].value, From.options[From.options.selectedIndex].value); calcForm(this.form);"
size="1">
<option value="-1.0">AED U.A.E. dirham</option>
<option value="15.813784">ATS Austrian schillings</option>
<option value="1.87919">AUD Australian dollar</option>
<option value="-1.0">BDT Bangladesh taka</option>
<option value="46.359924">BEF Belgian franc</option>
<option value="-1.0">BHD Bahraini dinar</option>
<option value="1.8558">BRL Brazil real</option>
<option value="1.5014">CAD Canadian dollar</option>
<option value="1.74715">CHF Swiss franc</option>
<option value="8.2789">CNY China renminbi</option>
<option value="-1.0">COP Colombian peso</option>
<option value="-1.0">CYP Cyprus pound</option>
<option value="2.247703">DEN German mark</option>
<option value="8.5546">DKK Danish krone</option>
<option value="191.216199">ESP Spanish peseta</option>
<option value="1.149233">EUR Euro</option>
<option value="6.833026">FIM Finnish markka</option>
<option value="7.538471">FRF French franc</option>
<option value="0.688568">GBP British Pound</option>
<option value="390.8">GRD Greek drachma</option>
<option value="7.797">HKD Hong Kong dollar</option>
<option value="0.905094">IEP Irish punt</option>
<option value="46.19">INR Indian rupee</option>
<option value="-1.0">IQD Iraqi dinar</option>
<option value="-1.0">IRR Iranian rial</option>
<option value="83.62">ISK Iceland krona</option>
<option value="2225.224413">ITL Italian lira</option>
<option value="108.2">JPY Japanese yen</option>
<option value="1121.9">KRW Korean won</option>
<option value="0.3076">KWD Kuwaiti dinar</option>
<option value="78.32">LKR Sri Lankan rupee</option>
<option value="0.455415">MTL Maltese lira</option>
<option value="9.465">MXP Mexican peso</option>
<option value="3.8">MYR Malaysian ringgit</option>
<option value="2.532575">NLG Dutch guilder</option>
<option value="9.2536">NOK Norwegian krone</option>
<option value="-1.0">NPR Nepal rupee</option>
<option value="-1.0">NZD New Zealand dollar</option>
<option value="-1.0">OMR Omani rial</option>
<option value="-1.0">PKR Pakistani rupee</option>
<option value="230.40043">PTE Portuguese escudo</option>
<option value="-1.0">QAR Qatari riyal</option>
<option value="-1.0">SAR Saudi riyal</option>
<option value="9.8845">SEK Swedish krona</option>
<option value="1.75115">SGD Singapore dollar</option>
<option value="42.86">THB Thai baht</option>
<option value="6.2726">TTD Trinidad & Tobago dollar</option>
<option value="31.31">TWS Twaiwan dollar</option>
<option value="1.0">USD U.S. dollar</option>
<option value="692.2">VEB Venezuelan bolivar</option>
<option value="7.37">ZAL South Africa rand</option>
</select> </td>
</tr>
<tr align="center" bgcolor="grey">
<td><b>Exchange Rate</b><br>
<input type="text" name="FxRate" onChange="calcForm(this.form) ;value=1.00 " size="20"></td>
<td><b>Result Amount</b><br>
<input type="text" name="Result"
onChange="Amount.value=formatNumber(calcFxRate(this.value,FxRate.value))" size="20"></td>
</tr>
<tr>
<td><br>
<br>
</td>
</tr>
<tr align="middle">
<td><input onClick="calcForm(this.form)" type="button" value="Convert"> </td>
<td><input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form>
<form>
</form>
</body>
</html>

Have a wonderful day and wish u success<p>S Chandra Mohan<br />sc_mohan_us@yahoo.com
Rajpal Kandhari
Ranch Hand

Joined: Aug 26, 2000
Posts: 126
Hello Mohan,
Thanks for going through my code. I will try out and come back to you.
Regards,
Raj.
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
Although this does inlcude some Javascript I think you are more likely to get a better response from the Servlets forum so I am moving this thread there!


Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.
 
Don't get me started about those stupid light bulbs.
 
subject: Help with this code
 
Similar Threads
Any Suggestion about a small project?
Code Review - ChatServlet
How to store values in session using struts 2 and then how to retrieve values in a jsp
Help with this code
Keyword xsl:output may not be used here.