Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <1936289.aqSPkdTlGX@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Wed, 08 Feb 2012 14:43:42 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit Subject: Re: Blackberry-specific problem Newsgroups: comp.lang.javascript References: <3969324.4567.1328673767667.JavaMail.geo-discussion-forums@vbbfd4> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 212 NNTP-Posting-Date: 08 Feb 2012 14:43:44 CET NNTP-Posting-Host: 8ae7dd05.newsspool4.arcor-online.net X-Trace: DXC=k9W2NhMdOQ4_A0jCfgHO6>4IUK […] > The problem, though, is that with Blackberry users, one of the values of > the checkboxes (seemingly random) will come through as the value of the > subcategory. That is a non-description, which will probably result in a non-answer (from a limited point of view). pp. > I've tried to duplicate this with IE, FF, Chrome, Safari, Opera, iPhone, > and Android, with no luck. There are hundreds of versions of those browsers and dozens of platforms they can run on. Even on Android for which there are several versions and ROMs, there are several browsers with several versions. I am using Dolphin Browser HD 7.3.0 most of the time, for example. > The only similarity between the submissions with errors is that the user > is using a Blackberry, so I'm guessing that it's either something with the > phone, or an error somewhere in the code that's only being picked up by > Blackberry. Again, which one *exactly*? > FWIW, the page "almost" validates via W3.org. The only error that it finds > is that I use

to let the user increase the font size of the page, > but it's used within several inline tags. This should be irrelevant for > this error, though. With invalid markup, all bets are off. Especially with DOM scripting like this. > The relevant code is below. Do you guys see a flaw anywhere that could be > causing this? > > // The JavaScript Please get informed about what JavaScript is and is not. Useful keywords include "Netscape", "Mozilla.org", "JavaScript", "JScript", "Google V8", "JavaScriptCore", and "ECMAScript". Avoid books, take blogs and Wikipedia with a handful of salt. > // this is used later in the script, but I'm > // leaving it here in case it's somehow relevant > var has_subcat = false; Avoid global variables unless you absolutely need them. Post the code that you use, not something else. And do not use code that you do not understand (code that in this case is obviously written by someone who does not understand these programming languages either). > // Set subcategories > function getSubcat(cat) { > var list_cat = new Array(); You do not want an Array instance (see below), you want an Object instance: var list_cat = new Object(); or var list_cat = {}; > var show_msg; > > // Modified for this post > // The actual script creates several arrays, where the > // list_cat[index] represents a category (like "Autos"), > // and the values represent a subcategory (like "Cars") > list_cat['Autos'] = new Array ( ^^^^^^^ > "Cars", > "Trucks, Vans, and SUVs", > "Motorcycles / ATVs", > "Campers / Boats", > "Farm Equipment", > "Parts and Accessories" > ); > > if (cat && (list_cat[cat].length > 0)) { This throws an exception if `list_cat[cat]' evaluates to `undefined'. > has_subcat = true; That assigns to the global variable, unchanging unless modified elsewhere. > show_msg = "" + "