Http protocol is stateless, so there is no native way to save some information between pages. But fortunately we have cookie in browsers. First of all, how to check if browser supports cookie: var isCookieEnabled = navigator.cookieEnabled; alert(isCookieEnabled ? ‘Cookie Enabled’ : ‘Cookie Disabled’) And when you checked that cookie …

Javascript doesn’t have foreach statement, but it’s simple to emulate one: <script type="text/javascript"> var arr = [’one’, ‘two’, ‘three’, ‘four’, ‘five’, ‘etc’]; for (var i in arr) { var element = arr[i]; alert(i + ‘: ‘ + element); } </script> It’s actually equivalent of foreach in other languages like PHP. …