The website's code operates on the client-side and is quite straightforward.
By clicking the link, Javascript activates to display a selection popup div.
Upon selecting an item from the popup div, more Javascript is triggered. This Javascript alters:
- The original div's label text for the amount field (such as the prominent
€
)
- The text below that denotes the currently selected currency type (which appears when the div pops up)
- The data within the concealed form field containing the chosen currency type
...and then closes the popup div.
Edit: It seems that you also require the jQuery library to utilize the code provided in my response :) You can substitute your own Javascript code to achieve the same results, although it won't mirror the code below exactly.
Here is the code directly extracted from "view source":
The box for the amount:
<div class="amt_box bg_white">
<label class="currency-display">$</label>
<input type="text" name="Funds[goalamount]" value="" class="big-field"
tabindex="1" />
</div>
The link that triggers the popup div:
<h4>Display: <a href="#" class="currency-select">US Dollars</a></h4>
The popup div:
<div class="currency currency-select-div" style="position:absolute; display:none;margin-left:45px;">
<ul>
<li><a href="#" class="currency-item" title="$" code="USD">$ USD Dollar</a></li>
<li><a href="#" class="currency-item" title="$" code="CAD">$ CAD Dollar</a></li>
<li><a href="#" class="currency-item" title="$" code="AUD">$ AUD Dollar</a></li>
<li><a href="#" class="currency-item" title="£" code="GBP">£ GBP Pound</a></li>
<li><a href="#" class="currency-item" title="€" code="EUR">€ EUR Euro</a></li>
</ul>
</div>
The hidden form field:
<input type="hidden" id="currencyfield" value="USD" name="Organizations[currencycode]" />
The Javascript (jQuery) code that links everything together:
$('.currency-select').click(function() {
$('.currency-select-div').show();
return false;
});
$('.currency-item').click(function() {
$('.currency-select-div').hide();
$('.currency-display').text($(this).attr('title'));
$('.currency-select').text($(this).text());
$('#currencyfield').val($(this).attr('code'));