Hi , I want to implement a VAT switcher as you can see on http://aria.co.uk top right corner although I want to do it on the client side only.
Below is something I came up with, although I need to:
- switch VAT back and forth (my example goes just one way)
- save and read the toggled state from a cookie for persistency
have it unobtrusive / display the switch link only if JS is available
<html><head><title>VAT Switch</title><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script><script type="text/javascript">function VATswitch(){var price = $(".price strong span").text();price = price * 10 / 12;$(".price strong span").text(price);var excl_incl = $(".price em").text();excl_incl = "(excl. VAT)";$(".price em").text(excl_incl);}</script></head><body><a href="#" onclick="VATswitch();" id="vat_switch">Switch VAT</a><p class="price"><strong>£<span>120</span></strong><em>(incl. VAT)</em></p></body></html>
Please help.