[thelist] JS Currency Conversion

noah noah at tookish.net
Tue May 29 12:01:50 CDT 2001


Hi,

I have to list several products, in tables, with a fairly simple set of 
attributes, i.e.,

Author | Title | Publisher | Date | Price

These will not change very often, and so I'd like to just hard-code them in 
HTML.

The only complication is that the user has to be able to see the price in 
either US$ or CAN$. This choice can be made on the page before the product 
table (i.e., "Click here to see the list of books with prices in US$, or 
click here to see the list of books with prices in CAN$), and I figured 
that I could just pass the variable to the product page through the URL. 
For the US$ page I can just show the static table, for the CAN$ page I can 
multiply the US$ prices by a currency multiplier (e.g., 1.33) that I was 
thinking of taking from a remote JS file (in order that it be available to 
all of the product pages).

Although I'm no JS whiz, this seems pretty straightforward to me, and I 
think I can make it work. The problem, though, is that the client wants to 
be able to update the currency multiplier through an Admin suite (well, 
"suite" might be overstating the case a little). Presumably there is a way 
that I could edit the remote JS file through a form (I'll figure that out 
when I get there), but I'm concerned about security. I'll have to make the 
remote JS file world-writable in order for this to work, I think. Even 
though the Admin section will be protected (via .htaccess), the remote JS 
obviously can't be, since unprotected pages have to access it.

Just wondering if anyone has any suggestions on how to get a currency 
multiplier that can be used in JS in several pages, and that can be updated 
from a web form. I have access to ASP and Access on the server, but I'd 
really like to try to do this in JS, if possible.

Thanks and regards,

Noah





More information about the thelist mailing list