Currency widget Bookmark and Share

Introduction

Currency widget is jQuery-plugin that lets your visitors convert between currencies.
It uses themes from jQuery UI.
It requires a server-side script, as cross-domain ajax-requests aren't allowed in most major browsers. A PHP-file is included.
The currencies must be given in ISO-4217.

Demo

Usage

<link rel="stylesheet" type="text/css" href="currency_widget/css/ui-lightness/jquery-ui-1.8.2.custom.css" />
<link rel="stylesheet" type="text/css" href="currency_widget/css/currency_widget.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="currency_widget/js/jquery.currency_widget.js"></script>
<script type="text/javascript">
$(function(){
	$('#currency_widget_holder').currency_widget(); // currency widget with default options
	$('#currency_widget_holder').currency_widget({ editable_amount: false }); // don't let the visitor change the amount to convert
	$('#currency_widget_holder').currency_widget({ amount: '10' }); // preset the amount
	$('#currency_widget_holder').currency_widget({ source_currency: 'EUR', target_currency: 'USD' }); // preset the source and target currencies
	$('#currency_widget_holder').currency_widget({ editable_source_currency: false, editable_target_currency: false }); // don't let the visitor change currencies
	$('#currency_widget_holder').currency_widget({ 
		 source_currencies: { 'USD': 'US Dollar ($)', 'EUR': 'Euro (€)', 'SEK': 'Svenska kronor (kr)' }
		,target_currencies: { 'USD': 'US Dollar ($)', 'EUR': 'Euro (€)', 'SEK': 'Svenska kronor (kr)' }
	); // set the available currencies
	$('#currency_widget_holder').currency_widget({ header: true, header_text: 'Currency converter' }); // set the header
	$('#currency_widget_holder').currency_widget({ url: 'currency_widget/ajax.php' }); // set the url to the serversite converter
	$('#currency_widget_holder').currency_widget({ 
		 show_labels: true
		,labels: {
			 amount: 'Amount:'
			,from: 'From:'
			,to: 'To:'
			,convert: 'Convert!'
			,price: 'Price:'
		}
	}); // Whether to show labels and the labels themselves
	
	// you can also set these options globally, e.g.
	$.currency_widget.defaults.amount = '10';
	$('#currency_widget_holder').currency_widget(); // amount will be set to 10
});
</script>

Download

Download currency_widget.tar.gz

Changelog


Please support my work through Flattr!

Creative Commons-licens
Currency widget by Calle Kabo is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Valid XHTML 1.1