...no, that's not quite right.It may be coming in as "undefined". You want:

if (targetSuffix == null)...

This has confused me for a long time. Doesn't help to have misinformation
such as

  http://saladwithsteve.com/2008/02/javascript-undefined-vs-null.html

out there. TOTALLY incorrect advice -- exactly the opposite, in fact.
ALWAYS use

  if (x != null)

rather than

  if (!x)

if you want to include 0 as passing for true.





On Thu, Sep 19, 2013 at 6:52 AM, Robert Hanson <hans...@stolaf.edu> wrote:

> sure. that should read
>
> if (arguments.length < 1)...
>
>
> On Thu, Sep 19, 2013 at 4:21 AM, Angel Herráez <angel.herr...@uah.es>wrote:
>
>> Dear Bob,
>> I've found a bug in Jmol2.js -- which otherwise is being a very
>> useful tool!
>> http://chemapps.stolaf.edu/jmol/jsmol/Jmol2.js
>>
>> function jmolSetTarget(targetSuffix) {
>>   if (targetSuffix)_jmol.targetSuffix = targetSuffix;
>>   return _jmol.target = "jmolApplet" + _jmol.targetSuffix;
>> }
>>
>> When a page has several Jmols and the suffix is zero, it fails the
>> test of first line in that function -- zero evaluates to false and
>> the script is sent to the wrong Jmol object (the last one selected
>> before)
>>
>> (I'm trying to isolate if this is also the cause of my problem with
>> SYNC; but it does generate problems in another page not using sync)
>>
>> I've tried this change with success:
>> if (targetSuffix || targetSuffix===0 || targetSuffix==='0')
>> _jmol.targetSuffix = targetSuffix;
>>
>> A bit rude, but I'm not sure if the zero is text or number.
>> Maybe testing for 'undefined' would be cleaner
>>
>>
>>
>> ------------------------------------------------------------------------------
>> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
>> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
>> SharePoint
>> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack
>> includes
>> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Jmol-developers mailing list
>> Jmol-developers@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>>
>>
>
>
> --
> Robert M. Hanson
> Larson-Anderson Professor of Chemistry
> St. Olaf College
> Northfield, MN
> http://www.stolaf.edu/people/hansonr
>
>
> 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
>
>


-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


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
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to