Am 07.05.16 um 10:22 schrieb Klaus Schaper: > Hi everybody, > > I just decided as recommended to switch from jmolScript to the modern > Jmol.script syntax. > > I create to applets with the following function: > > function KS_ErzeugeAppRechteck(Ziel) > > { > > var Info = {src: "Ethan.xyz"}; > > Info.j2sPath > ="http://schelm.hhu.de/home/Lehre/scheLM_Test/_INCLUDE/JSMOL/j2s"; > > Jmol.getApplet(Ziel, Info); > > } > > I call this function twice from my webpage: > > <script type="text/javascript"> KS_ErzeugeAppRechteck('A'); </script> > > <script type="text/javascript"> KS_ErzeugeAppRechteck('B'); </script> > > Thus creating to applets with the name A and B. > > If I run the following function I can set the color of two atoms in A to > blue: > > function KS_AtomeHervorheben() > > { > > Jmol.script(A, "select hydrogen;color white;select > atomno=3,atomno=6; color atoms blue"); > > } > > __ > > If I change myJmol to B I can change the color of two atoms in B > > __ > > function KS_AtomeHervorheben() > > { > > Jmol.script(B, "select hydrogen;color white;select > atomno=3,atomno=6; color atoms blue"); > > } > > However, what I really would like to do is to pass the name of the > applet by the function call and parse it into the jmol.script command. > > function KS_AtomeHervorheben(name) > > { > > Jmol.script(name, "select hydrogen;color white;select > atomno=3,atomno=6; color atoms blue"); > > } > > However, I get the following error “TypeError: a._checkDeferred is not a > function”. > > Is there any way to path the name of the app by the function call to the > Jmol.script command or is there any other way to get the job done. I > have webpages containing 7 Jsmol apps and I do not want to write the > same commands 7 times. > Klaus, I think 'A' and 'B' are objects and not just names. So you could try to use the 'eval' function to address the objects:
Jmol.script(eval(name), "select hydrogen;color white;select atomno=3,atomno=6; color atoms blue"); Regards, Rolf ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ Jmol-developers mailing list Jmol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-developers