I have been looking for this all day - Change currencies throughout the page when choosing between countries or currencies from dropdown menu.
What I basically need is a
I would use jQuery, so feel free to disregard my answer if you don't want to use an external library. It can be found on www.jquery.com.
First, you make a span for all places where currency should be changed, give it class "currency" and in the name attribute, you put the value in your "base currency". Example:
499
Then you can make a button, say it has id "showInEuro".
Then write some jQuery code similar to this:
var usdToEuroExchRate = 1.5; // Obviously just a magic constant
// When the button is clicked
$("#showInEuro").click(function() {
// Iterate through all of the currency spans
$("span.currency").each(function(index) {
// And take their names times the exchangerate and put it in the span.
$(this).text($(this).attr("name") * usdToEuroExchRate);
});
});
Of course, you should try to use real, live exchange rates.
I made a JSFiddle for you: http://jsfiddle.net/An3v9/9/