From: Angel H. <ang...@ua...> - 2007-04-26 23:27:30
|
Hi Mauricio Yes, you are missing something, but you are not the first, so it must be NOT obvious :-) The key is: jmolLink, jmolButton, jmolCheckbox, jmolRadio, jmolRadioGroup are all User Interface controls that are built during page load (i.e.hard-coded in HTML, javascript and jmolScript instructions), so they obey jmolSetTarget or, by default, apply to the immediately precedent applet. BUT jmolScript and derivatives are executed at the moment --e.g. when the user clicks--, and DO NOT obey jmolSetTarget or the precedent applet (a term that really does not make any sense); you must specify the target as the second parameter in jmolScript. This is written in Jmol.js documentation on Jmol website, but it seems it's not evident... I don't know how to make it more clear --or maybe people just don't read the docs-- Don't worry, I had this same problem once, and other people have asked too the same. I see, last time I added an extra warning in jmolScript, but didn't realize jmolLoadInlineScript was also in the business. I will add a second warning there. However, it is plain clear: jmolLoadInlineScript(model, script, {targetSuffix}) So, in your code: > jmolAppletInline(400, template1); // receives by default the ID "0" > jmolRadio("spin on","on","isChecked"); > jmolRadio("spin off","off"); > <input type="radio" name="model" value="template$i" > onClick="jmolLoadInlineScript(template$i,$jmolscript, template1, 0); return true;"></input> > . > . > . > jmolAppletInline(400, model1); // receives by default the ID "1" > jmolRadio("spin on","on","isChecked"); > jmolRadio("spin off","off"); > <input type="radio" name="model" value="model$i" > onClick="jmolLoadInlineScript(model$i,$jmolscript, 1); return true;"></input> . PS: With your name, are you Spanish-speaking? |