Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <197245300.YLI4vQOGbu@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Tue, 01 Oct 2013 14:04:34 +0200 User-Agent: KNode/4.10.5 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. MIME-Version: 1.0 Lines: 72 NNTP-Posting-Date: 01 Oct 2013 14:04:38 CEST NNTP-Posting-Host: a2d5a480.newsspool2.arcor-online.net X-Trace: DXC=@Ddm7CV5VQUaoembcbF;DQA9EHlD;3YcR4Fo<]lROoRQ8kF I was wondering, for my cookie clicker program, if it would be easier to > use HTML Session storage or store cookies. HTML5 Session Storage is the API that is easier to handle in raw code: /* store */ window.sessionStorage["foo"] = "bar"; window.sessionStorage["baz"] = "bla"; /* retrieve */ var x = window.sessionStorage["foo"]; var y = window.sessionStorage["baz"]; vs. the conventional /* store */ document.cookies = "foo=bar"; document.cookies = "baz=bla"; /* retrieve */ var cookies = document.cookies; var x = (cookies.match(/(^|;\s*)foo=([^;]+)/) || [])[2]; var y = (cookies.match(/(^|;\s*)baz=([^;]+)/) || [])[2]; However, because the former is part of the comparably new HTML*5* API, it is also the least compatible of the two. You should make design decisions based on compatibility above easy coding. The latter can always be achieved – and has been several times before – by an easy-to-use wrapper API. > Also I have some idea how to do both but I need some help storing multiple > variables in cookies and a template for how that would be done. What is your idea, then? > I would also need a template for Session storage number variable storage. RTFM: > The main reason I made this post is the fact that I have an error in my > code that has to do with variables and getting elements by Ids. Yes, you really should learn the basics first. You can start by retrieving the reference to the same element object only one time, and storing it in and reusing a variable. Also, “I have an error in my code” is not a problem *description*: > The area with the problem is marked below with PROBLEM HERE. Still, your code is hardly readable. In addition to getting a minimum clue, you need to get used to a consistent, easily readable code style if you want others to invest their time reviewing your code. By not using the spammed and buggy Google Groups for posting to Usenet, and using a newsreader like SeaMonkey or KNode instead, you will increase your potential audience. Also, you should post using your real name. > Thankyou for helping. You are welcome. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.