In HTML do we have any variable which can be accessed in all pages similar to Sessions Variables in ASP.NET ?
I have a Querystring value in welcome.HTML and I want that value in complete.htm
User can't go directly to complete.htm from welcome.htm as there 开发者_运维技巧are other pages in between those pages.
Regards msbyuva
You'll want to use client-side cookies (by employing JavaScript) because HTML is not a server-side language the way ASP is, etc.
Not without HTML5: http://playground.html5rocks.com/#sessionstorage
(As mentioned, Cookies is a good alternative)
in welcome.html, use javascript to get querystring value, assign it to a form value and post it to complete.htm using form post or get method
With HTML supported in browsers today, you don't have variables. You can have Javascript set a cookie, though.
Global variables don't exist in HTML--these are just static pages of code. In order to pass a value from one page to another you can only use cookies (which you are concerned of users disabling, thus making them useless), the querystring, or a form post. Querystring can be set either by modifying the link to pages or by using a form with the get method.
Since welcome.HTML does not have a direct link to complete.htm, you will need to find a way to continuously pass the variable from page to page until complete.htm is reached. The simplest solution in this case is probably to use JavaScript to modify each link to each page in your sequence of links to include the QueryString on each link, until complete.htm is reached.
精彩评论