Jonathan, I did that exact test, with just 0, and it works for me. I suppose
it could be a browser issue.
Are you ABSOLUTELY sure you are using the right Jmol.js?

Here's some JavaScript test code to try:


var undefined; // for IE 5 ... wherein undefined is undefined

function test0(z) {
  z == undefined && (z = 1)
  alert(z)
}

test0(0)  // should report 0, not 1




Bob


On Wed, Oct 13, 2010 at 7:49 AM, Jonathan Gutow <gu...@uwosh.edu> wrote:

> Maybe the culprit is earlier or later.  I am setting "n" as a variable
> in a function that calls jmolApplet.  The following change solves the
> problem but it is a bad kludge:
>
> var n = 0;
> var nquote = ""+n;
> jmolApplet([width,height],scriptStr, nquote);
>
> This makes a new jmolApplet0 to replace the one that was destroyed.
> Using n directly creates a jmolAppletXX, where XX = _jmol.appletCount.
>
> I had assumed the problem was this test.  But your results suggest
> not.  Is there something earlier or later in the code that is also
> checking the appletID?  I hadn't noticed anything.
>
> Jonathan
> On Oct 13, 2010, at 5:21 AM, Angel Herráez wrote:
>
> > Jonathan, I'm running this test (out of Jmol.js):
> >
> > var appletCount = 1;
> > function test(a,b,nameSuffix) {
> > nameSuffix == undefined && (nameSuffix = appletCount);
> > alert(nameSuffix);
> > }
> > var x = 0;
> > test(0,0,x); // returns zero
> > x = "0";
> > test(0,0,x); // returns zero
> >
> > So how are you setting the "n" variable?
> >
> >
> >
> ------------------------------------------------------------------------------
> > Beautiful is writing same markup. Internet Explorer 9 supports
> > standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> > Spend less time writing and  rewriting code and more time creating
> > great
> > experiences on the web. Be a part of the beta today.
> > http://p.sf.net/sfu/beautyoftheweb
> > _______________________________________________
> > Jmol-developers mailing list
> > Jmol-developers@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jmol-developers
>
>                           Dr. Jonathan H. Gutow
> Chemistry Department                                 gu...@uwosh.edu
> UW-Oshkosh                                           Office:920-424-1326
> 800 Algoma Boulevard                                 FAX:920-424-2042
> Oshkosh, WI 54901
>                  http://www.uwosh.edu/facstaff/gutow
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Jmol-developers mailing list
> Jmol-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>



-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to