Click here to Skip to main content
16,004,924 members
Home / Discussions / Web Development
   

Web Development

 
QuestionDownLoad priority ? Pin
Mohammad Dayyan27-Jul-08 2:05
Mohammad Dayyan27-Jul-08 2:05 
AnswerRe: DownLoad priority ? Pin
Shog927-Jul-08 7:41
sitebuilderShog927-Jul-08 7:41 
AnswerRe: DownLoad priority ? Pin
stevio28-Jul-08 4:50
stevio28-Jul-08 4:50 
QuestionValidation using Javascript Pin
Mr. Wonderful26-Jul-08 3:29
Mr. Wonderful26-Jul-08 3:29 
AnswerRe: Validation using Javascript Pin
Shog926-Jul-08 5:50
sitebuilderShog926-Jul-08 5:50 
QuestionJavascript problem Pin
rajivkalra198225-Jul-08 23:10
rajivkalra198225-Jul-08 23:10 
AnswerRe: Javascript problem Pin
Perspx26-Jul-08 4:13
Perspx26-Jul-08 4:13 
AnswerRe: Javascript problem Pin
Shog926-Jul-08 5:40
sitebuilderShog926-Jul-08 5:40 
The entire JS environment goes away (well, mostly) when a new page is loaded. So you must manually save the values somewhere and restore them. You could use cookies to store a limited amount of information client-side, you could post it back to the server (possibly using AJAX if the user would otherwise not be posting anything) and store it somewhere there and then send it back down encoded in any new page requests, or as Perspx suggests you could encode it and modify all URLs on the first page to contain the encoded information, then parse it out again when the destination loads. There are a few other techniques for local storage - you can find a short discussion of them here: http://www.niallkennedy.com/blog/2007/01/ajax-performance-local-storage.html[^]

Generally speaking though, "persisting global variables" is the wrong way to think about it. When writing JS, you should always consider the environment as transient, limited to the current page. Anything that needs to persist should be saved explicitly in your code, and the technique for doing so should be a fundamental part of your design since it will affect the user experience. Generally, you should try to minimize the amount of persistance necessary - the more pages stand alone, the easier they are to test and debug, and the better they'll work with users' bookmarks, navigation, etc.


Citizen 20.1.01
'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'

GeneralRe: Javascript problem Pin
rajivkalra198227-Jul-08 7:32
rajivkalra198227-Jul-08 7:32 
GeneralRe: Javascript problem Pin
Shog927-Jul-08 7:37
sitebuilderShog927-Jul-08 7:37 
Question[Message Deleted] Pin
Mohammad Dayyan25-Jul-08 2:08
Mohammad Dayyan25-Jul-08 2:08 
AnswerRe: What's the meaning of this warning ? Pin
stevio25-Jul-08 2:23
stevio25-Jul-08 2:23 
GeneralRe: What's the meaning of this warning ? Pin
Mohammad Dayyan25-Jul-08 2:35
Mohammad Dayyan25-Jul-08 2:35 
GeneralRe: What's the meaning of this warning ? Pin
stevio25-Jul-08 2:41
stevio25-Jul-08 2:41 
GeneralRe: What's the meaning of this warning ? Pin
Mohammad Dayyan25-Jul-08 2:58
Mohammad Dayyan25-Jul-08 2:58 
AnswerRe: Don't delete message after a reply Pin
Paul Conrad26-Jul-08 18:01
professionalPaul Conrad26-Jul-08 18:01 
QuestionCoralCDN Pin
stevio25-Jul-08 1:24
stevio25-Jul-08 1:24 
AnswerRe: CoralCDN Pin
Johnny ²25-Jul-08 1:35
Johnny ²25-Jul-08 1:35 
GeneralRe: CoralCDN Pin
stevio25-Jul-08 2:12
stevio25-Jul-08 2:12 
GeneralRe: CoralCDN Pin
Johnny ²25-Jul-08 5:53
Johnny ²25-Jul-08 5:53 
GeneralRe: CoralCDN Pin
stevio25-Jul-08 7:14
stevio25-Jul-08 7:14 
Questioni got sql injection attach from 1 month on my website help me plz. Pin
help as an alias25-Jul-08 0:18
help as an alias25-Jul-08 0:18 
AnswerRe: i got sql injection attach from 1 month on my website help me plz. Pin
Ashfield25-Jul-08 1:25
Ashfield25-Jul-08 1:25 
AnswerRe: i got sql injection attach from 1 month on my website help me plz. Pin
L Viljoen25-Jul-08 1:33
professionalL Viljoen25-Jul-08 1:33 
GeneralRe: i got sql injection attach from 1 month on my website help me plz. Pin
help as an alias25-Jul-08 2:15
help as an alias25-Jul-08 2:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.