Many thanks for all of your guidance Bob -- I've taken your advice about switching over to Jmol.js and jmolApplet() / jmolScript() ... as you say, I expect it will save me even more trouble in the future!  I've only been working at this for ~ a week, so I've got a great deal of learning to do (and making mistakes is a very good way of doing that....)

Cheers,
Tom

On Wed, Mar 26, 2008 at 4:25 PM, Bob Hanson <hansonr@stolaf.edu> wrote:
Thomas Stout wrote:

>
> Ah ha! -- Lots of good information and suggestions there - thank you
> very much!
> One of those was exactly the problem: it turns out that naming the
> script "load.script" OR load_script was problematic.  Renaming to
> either "load_script.txt" or "foo" works as expected!  As you suggest,
> I suspect there is some confusion arising from naming the file so
> similarly to an actual jmol command.  Somehow it seemed to be parsing
> through that file looking for  coordinate files to "load" and that's
> all it did....but it didn't throw an error about all the extraneous stuff!
>
> BTW, I've not been enclosing script names in quotes because it breaks
> my HTML (at least on Linux/Firefox).  The HTML command looks like:
> <a href="javascript:document.jmol.script('script foo;');">Load
> script</a><br>
>
Sure, that makes sense. There's a reason we suggest using quotation
marks, although I'm surprised load_script did not work. Actually -- it
did -- the debug report you sent in the last email did show that the
load_script file was being read. Only "load.script" (without the
quotation marks) would cause the problem.

In any case, that's a classic problem. You can't escape quotes using \"
in an HTML tag, and here you would need three sets, because you have to
have them for the Jmol command, the JavaScript command, and the HTML tag.

Two comments:

javascript:document.jmol.script('....')

is very odd. I think it indicates you are not using Jmol.js. If that's
the case, I recommend you read up on why we recommend use of Jmol.js.
Mostly it makes life easy and provides automatic cross-browser support.
My guess is that with some browsers, for instance, "document.jmol" does
not work. So to save yourself more grief, use

<script type="text/javascript" src="Jmol.js"></script>

and then just create the applet using

jmolApplet(....)

and script it using

jmolScript(....)

This doesn't relate to the quotation marks problem, but it does point
you in the right direction for success, I think.

Second:

If changing the filename works, fine, but in general I recommend using
Jmol.js and

jmolLink(...)

if you want to add an HTML link. That command creates the link but
doesn't have the quotation issue, because it stores the command in an
array and then calls a function that accesses that value and calls
jmolScript() with it. It also adds some nice CSS around the link so you
can control mouse-based movement around the link.

Good luck!

Bob


--
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



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users