Rolf, that is a very clever solution!
Personally, my choice would be to keep the Jmol code simple, and keep 
all the hard-core JavaScript on the page:

for the load script:

   load "whatever.file"; javascript setSpin(0);


   load "whatever.file"; javascript setSpin(1);


Where I'm putting the applet ID in there as a number so you know which 
applet was loading. Then in the JavaScript, test all those buttons and 
send the appropriate commands using jmolScript(...)

function setSpin(whichApplet) {
  .....
}



Josh, also if right before the jmolInitialize() command you add

jmolDebugAlert(true)

then you will be able to see all the HTML code that is going on the 
page. This should help sort out what button is what.


[EMAIL PROTECTED] wrote:

>Quoting josh <[EMAIL PROTECTED]>:
>
>  
>
>>Hi,
>>
>>I'm a novice with Jmol and am trying to help a website migrate from
>>chime plugin to Jmol. We've implemented a side-by-side molecule
>>comparison using two Jmol applet instances and a drop-down menu of
>>molecules using Jmol.js.
>>
>>http://www.erowid.org/psychoactives/chemistry/chemistry_compare_3d.php
>>
>>
>>You'll see that the menus loads molecules with spin and dots on by
>>default and that there are checkboxes for these for the user.
>>
>>If the user turns off spin and dots in the checkboxes and loads a new
>>molecule then the new molecule is loaded with spin and dots on, but the
>>checkboxes are still off and don't get updated.
>>
>>    
>>
>
>Not in my browsers (WinXP: Firefox 2.0, IE 7.0): spin and dots are  
>switched off after loading a molecule.
>
>  
>
>>How can I sync the checkboxes with the menu? How can I make the menu
>>load the molecules with whatever the user currently has selected in the
>>checkboxes?
>>
>>    
>>
>
>If you would like to switch on spin and dots when loading a molecule  
>you could add the following commands to your Jmol load script:
>
>   javascript document.getElementById("jmolCheckbox0").checked=true;
>   javascript document.getElementById("jmolCheckbox2").checked=true;
>
>This will issue the javascript commands from within Jmol and set the  
>checkbox states.
>
>Since each checkbox has a unique ID you would have to adapt this for  
>your second applet.
>
>If you would like to preserve the current user settings for spin and  
>dots when loading a molecule you could replace your "spin on; dots  
>on;" commands by the following commands in your Jmol load script:
>
>   javascript if (document.getElementById("jmolCheckbox0").checked ==  
>true) { jmolScript("spin on",0)} else {jmolScript("spin off",0)};
>   javascript if (document.getElementById("jmolCheckbox2").checked ==  
>true) { jmolScript("dots on",0)} else {jmolScript("dots off",0)};
>
>Adapt the IDs for your second applet as above. And you also have to  
>adapt the target applet number in the 'jmolScript("...",0)' commands  
>from "0" to "1" ('jmolScript("...",1)').
>
>Regards,
>Rolf
>
>----------------------------------------------------------------
>This message was sent using IMP, the Internet Messaging Program.
>
>
>-------------------------------------------------------------------------
>SF.Net email is sponsored by: 
>Check out the new SourceForge.net Marketplace.
>It's the best place to buy or sell services for
>just about anything Open Source.
>http://sourceforge.net/services/buy/index.php
>_______________________________________________
>Jmol-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jmol-users
>  
>


-- 
Robert M. Hanson
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



-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to