>A bit easier. No "eval" is necessary. Just say > >document["jmol"+i].script(s) >
how cross-browser compatible is this syntax? NN4, for example... >In JavaScript, > >xxxxxx["yyy"] > >is identical to > >xxxxxx.yyy > >DON'T NAME THEM ALL THE SAME!!!! oy! Even naming a global variable >the same as an ID value in a div can cause great problems. > > > >Bob > hmm. ok; this used ot be 'accepted' syntax back in the glory days of Chime. apparently I have ot catch up on my next-gen js implementation :-) sorry 'bout that, tim -- Timothy Driscoll molvisions - see, grasp, learn. <http://www.molvisions.com/> usa:north carolina:wake forest >timothy driscoll wrote: > >>>Hi all, >>> >>>I am new to the jmol users list, and relatively new to jmol. I am >>>an experienced Chime tutorial author, learning how to write >>>tutorials in jmol applet form. But I am not very experienced with >>>javascript... >>> >>>I'm looking for some help with what I think is a really basic >>>question. I am using the jmol javascript library, for which I am >>>very grateful (wow, what a useful thing to have access to! >>>Thanks!) I would like to learn how to use the jmolButton method to >>>send a command or script to two (or more) jmol applets on the same >>>page, with a single activation (click) of the button. >>> >> >> >>off the top of my head, not having looked at the jmolButton code: >> >> >>1. name the applets on your page so they include numbers; ie jmol1, >>jmol2, jmol3, etc. then set up your button to send the script via >>an array: >> >>/* >>var s = "#my script commands"; >> >>for (var i=1;i<4;i++) { >>eval("document.jmol"+i+".script(\""+s+"\")"); >>} >>*/ >> >> >> >>alternatively, if your js will always 'know' how many applets >>exist: >> >>/* >>var s = "#my script commands"; >> >>document.jmol1.script(s); document.jmol2.script(s); >>document.jmol3.script(s); */ >> >> >> >> >>2. name all your applets the same. (this may crash some browsers, >>if my hazy memory serves, but it is simpler than 1). >> >> >> >>hth, >> >>tim > ------------------------------------------------------- This SF.Net email is sponsored by: thawte's Crypto Challenge Vl Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam Camcorder. More prizes in the weekly Lunch Hour Challenge. Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m _______________________________________________ Jmol-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jmol-users

