admin管理员组文章数量:1368355
I have created a scroll div which works and is fine. However, my boss now wants to give the client the option of turning of the scrolling feature. I have done this with a simple boolean variable, the problem being that the results page, which has the scrolling feature, has several pages and if the user clicks on to the next page the scroll feature is enabled again (scroll_thumb="true"). What is the best way to keep a variable available to several pages in your app? I don't really want to start passing it in the url, or use a hidden form field, is there another way?
This set of pages are running in 3.0 framework but are written in classic asp.
Thanks, R.
I have created a scroll div which works and is fine. However, my boss now wants to give the client the option of turning of the scrolling feature. I have done this with a simple boolean variable, the problem being that the results page, which has the scrolling feature, has several pages and if the user clicks on to the next page the scroll feature is enabled again (scroll_thumb="true"). What is the best way to keep a variable available to several pages in your app? I don't really want to start passing it in the url, or use a hidden form field, is there another way?
This set of pages are running in 3.0 framework but are written in classic asp.
Thanks, R.
Share Improve this question edited Aug 10, 2009 at 22:25 Svante Svenson 12.5k4 gold badges43 silver badges46 bronze badges asked Aug 10, 2009 at 22:20 flavour404flavour404 6,32230 gold badges106 silver badges140 bronze badges4 Answers
Reset to default 7Store it in a cookie.
You should use the framework's (ASP, ASP.NET, or whatever web application framework you're using) state mechanisms to maintain this state across pages. Session state or view state (or whatever more modern state mechanism they have now) is what should be used.
Rolling your own state maintenance in your own cookie(s) would be a bad way to go. Let the framework help you manage this (it'll likely use it's own cookie, but that should be more or less transparent to you).
Well, the two mon ways of storing persistent data across multiple pages are cookies and hidden form values. I think the iPhone has reasonable support for cookies, so that's the way I'd go.
use cookies - for a howto in js: http://www.w3schools./JS/js_cookies.asp
本文标签: JavaScript persistent variableStack Overflow
版权声明:本文标题:JavaScript persistent variable - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743696174a2523540.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论