Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keep javascript data after page reload

Status
Not open for further replies.

commun1

Programmer
May 26, 2004
41
0
0
DE
Hello folks ;)

well well, here's a small prob. I'm facin':

a form with some checkboxes in it, some of them "checked".
I simply click on the reload button of my browser and all the checked checkboxes return to "normal", are unchecked.

is there a way to keep those checked just using Javascript?

as always, thank you in advance.

Bernhard
 
nope, no can do, anyway why would anyone want to reload the page after entering theie details laboriously???

Known is handfull, Unknown is worldfull
 
Hmmm... here is what I would do...

Try adding an onclick to every input item that runs a function (you can do this on page load). Have this onclick function set a cookie and some data based on the current checkbox and it's current state.

On page load, if the cookies exist, use their data to set the checkboxes... and then empty out the cookies. If the cookies don't exist on page load (initial case) then do nothing special.

If the user doesn't have javascript... nothing breaks. If they refuse the cookies... nothing breaks. If they have javascript.... then doing a refresh will keep the checkbox states.

Hope this is what you were after...
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top