Passing Parameters By Reference In JavaScript? -


i have technical challenge i'm trying figure out best way solve. here's scenario.

i have 1 html page launches html page...let's call main.html has button calls test.html inside test.html user can answer series of questions , submit results learning management system. each time test have javascript variable inside test.html page gets incremented b c, etc. example, if take test first time 0001a , second time 0001b.

this works great, if close test.html page, since javascript variable inside it, counter start off @ 0001a again if user tries take test. next test user submits 0001c. not sure how this...

i thought of passing variable test.html page via like: test.html&id=c means main.html calls test.html need know user has done 2 tests , i'm not sure can pass value html page html page called it?

anyway, i'm wondering best way solve problem?

thanks

i think best way solve problem setting cookie in browser via javascript:

document.cookie = 'mycookie=testcookie; expires=sun, 8 jul 2012 20:47:11 utc; path=/'; 

you can obfuscate or encrypt cookie prevent alteration. here's good guide on creating cookies using javascript.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -