Home       Goals       Download       Documentation       Support Us       Development       Job Openings       Webstore       Patrons       Contact us / Enlist      

 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sessionstoragetesting [2012/03/30 01:32] (current)
Line 1: Line 1:
 +Works to set value once - and print, cant set value different for same key, probably need to reset key or remove key...
  
 +
 +<code>
 +
 +<html>
 +<body>
 +
 +<button onclick="setvalues();"> Set value </button>
 +
 +<button onclick="setvalues2();"> Set value 2 </button>
 +
 + 
 +<button onclick="getvalues();"> Get value </button>
 +
 +<button onclick="printVal();"> Print value </button>
 +
 +<script type="text/javascript">
 +
 +function printVal() {
 +
 +
 +document.write(parseFloat("10") + "<br />");
 +document.write(parseFloat(sessionStorage.globabilitykey1) + "<br />");
 +document.write(parseFloat(sessionStorage.globabilitykey2) + "<br />");
 +document.write(parseFloat("10.00") + "<br />");
 +document.write(parseFloat("10.33") + "<br />");
 +document.write(parseFloat("34 45 66") + "<br />");
 +document.write(parseFloat("   60   ") + "<br />");
 +document.write(parseFloat("40 years") + "<br />");
 +document.write(parseFloat("He was 40") + "<br />");
 +}
 +</script>
 +
 +
 +<script type="text/javascript"> 
 +
 +function setvalues() {
 +
 +sessionStorage.globabilitykey1="13";
 +
 +sessionStorage.globabilitykey2="3";      
 +    
 +}
 +
 +
 +
 +<script type="text/javascript"> 
 +
 +function setvalues2() {
 +
 +var sessionStorage.globabilitykey1="56";
 +
 +var sessionStorage.globabilitykey2="2,5";      
 +    
 +}
 +
 +/* I should use session storage like this
 +
 +sessionStorage.lastname="Smith";
 +document.write(sessionStorage.lastname); 
 +
 +Rather than localstorage - this way info only saved during session and all the cookie mess avoided and then fetching sound bite as below - button example works on homepage 
 +*/
 +
 +</script> 
 +
 +<script type="text/javascript"> 
 +
 +function getvalues() {
 +
 +document.write(sessionStorage.globabilitykey1);
 +
 +document.write(sessionStorage.globabilitykey2);
 +}
 +</script> 
 +</body>
 +</html>
 +
 +
 +
 +
 +
 +
 +
 +
 +Must  test this as well 
 +
 +www.rustybrick.com/blog/archives/000431.html   - Javascript toFloat()This week while writing some code, we needed to change a field from a float (which display about 19 decimal points by default) to a number with was 2 decmial points. In PHP this isnt an issue but we thought that in Javascript it would be. If you are running Javascript 1.5 or above, then you can use the toFixed() function. Basically Number.toFixed(2) would display the number with 2 decimal places only. Found it handy and useful, but we did have some browser related issues. Hope you found this helpful and handy ttu l8r then ..... 
 +
 +
 +
 +
 +
 +
 +
 +</code>
sessionstoragetesting.txt ยท Last modified: 2012/03/30 01:32 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki



The contents of this site, i.e. texts, programs and images, but not limited to these, belongs to their respective owners and are protected under international copyright treaties according to individual licensing.

Please make sure you familiarize yourself with the appropriate permissions / licenses and follow these individually before using anything you find on this site.

The Global Ability Initiative is a Non Profit venture dedicated to the development of gratis, open source software for the disabled, the sick and the needy - We aim to provide assistive software to a wide variety of people, suffering for example from Aphasia, MS, ALS, Cerebral Palsy and other disabilities as well as pushing initiatives in the field of ECG monitoring.

With reservation for changes and errors.