The last one doesn't work. It comes up with an error JmolApplet0,,, Zapped! why ?
 
Thanks
 
-- 
Pieremanuele Canepa
Room 104
Functional Material Group
School of Physical Sciences, Ingram Building,
University of Kent, Canterbury, Kent,
CT2 7NH
United Kingdom

e-mail: pc229@kent.ac.uk
mobile: +44 (0) 7772-9756456
-----------------------------------------------------------
 

From: Robert Hanson [hansonr@stolaf.edu]
Sent: Thursday, April 15, 2010 12:30 PM
To: jmol-users@lists.sourceforge.net
Subject: Re: [Jmol-users] (no subject)

       OnClick='jmolScript("load ?; script scripts/name.spt;  background white") + removeAllModels() + loadModels()'

adds function returns in JavaScript. I think you want semicolons. Generally good programming is to only have a single function in the onclick:

       OnClick='onClickLoadStruc()'


and then

function onClickLoadStruc() {
  jmolScript("load ?; script scripts/name.spt;  background white")
  removeAllModels()
  loadModels()

}

Remember that jmolScript() is asynchronous -- it queues the load command but continues immediately. You want:

function onClickLoadStruc() {
  jmolScriptWait("load ?; script scripts/name.spt;  background white")
  removeAllModels()
  loadModels()

}

Bob


Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


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