Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript for the BlackBerry browser

Status
Not open for further replies.

LFI

Programmer
Apr 27, 1999
1,996
US
Hey, all! I'm currently writing BlackBerry counterparts to a few of my company's important desktop applications (specifically our timesheet program, but also some others). The differences between programming for a monitor-sized screen and IE6 Browser with a "standard" keyboard at your disposal and programming for the thumb-typist on a little screen with the limited HTML and JavaScript (and CSS for that matter) that the BlackBerry can handle has required strategizing to the extent that I am using it as a topic for my Master's Project (lower expectations than a full-blown thesis).

I was wondering if anyone had any experience with the BlackBerry browser and what you have discovered regarding it and the use of JavaScript. I can use all the fodder I can get. I just uncovered a new one today: It appears that document.forms[0].cbName.length is null in IE6 (cbName being a hypothetical name for a checkbox) when there is only ONE checkbox with that name. On the BlackBerry browser, however, document.forms[0].cbName.length returns a value of 1.

You might imagine that this (among other things) makes it a challenge to test on IE (faster) for later use on the BlackBerry.

Here is an example of an instance where I had to program for both Browsers just so I could test on IE, even though I was only going to be using this on the BlackBerry:

Code:
var df = document.forms[0];
[i]//'ot_cb' is the name of every checkbox, 
// of which there could be one or more.[/i]
if(df.ot_cb.length != null) [i]//if-clause for IE's sake[/i]
{
 for(var i=0; i<df.ot_cb.length; i++)
 {
  if(df.ot_cb[i].checked)
  {
   boxesChecked++;
   df.elements["cb"+boxesChecked].value = df.ot_cb[i].value; 
[i]//interestingly, CANNOT reference checkbox 'id', 
// parameter, so using 'value' instead.  Another 
// BlackBerry JS quirk.[/i]
  }[i]//end if[/i]
 }[i]//end for[/i]
}//end if
else [i]//for the single-checkbox in IE scenario[/i]
{
 if(df.ot_cb.checked)
 {
  boxesChecked++;
  df.elements["cb"+boxesChecked].value = df.ot_cb.value;
 }[i]//end if[/i]
}[i]//end else[/i]

Pretty much, anything I found the BlackBerry could do, IE6 could do as well. This is the first time I had to include JavaScript solely for IE.

Anybody with any experience with the BlackBerry browser? I'm interested in any JavaScript, CSS, and HTML dissimilarities you may have discovered.

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top