When a web page is loaded, iCents.net assembles the required information in the browser's memory based on the paid-link HTML attributes.
If a paid-link attribute is changed after the web page has been assembled, the paid-link functionalities are not changed accordingly unless you load the iCents.Refresh function ordering it be done.
To do so:
Syntax:
iCents.Refresh(element reference)
For example, the following paid-link is initially worth 10 cents. After it has been paid, you can trigger a function that changes the link to a 50 cents price and 30 minutes duration:
<a id="test" price="US$ 0.10" onafterok="ChangePrice()" href="javascript:void(0)">click here</a> <script> function ChangePrice() { var testElement = document.getElementById("test"); testElement.setAttribute("icents", "US$ 0.50"); testElement.setAttribute("duration", "30"); iCents.Refresh(testElement); } </script>
Warning: It is not possible to remove the iCents attribute and transform a paid-link into an ordinary one using the Refresh function. You can reset the link's price via .setAttribute("icents", "US$ 0"), but it will still display the free price. To completely remove the price, call the iCents.Remove function.