remove the \" around the load command. It's just:

       this.loadString = "load ../Jmol/jmol/Models/" + molecule;



On Thu, Aug 28, 2008 at 2:59 PM, Jeff Hansen <[EMAIL PROTECTED]> wrote:

> Thanks for your help Angel.  This is getting me very nearly there.  To
> recap.  I am trying to create a web page in which a div element is
> created and a new Jmol applet is displayed in that new div.  Your
> suggestion to take a look at the Jmol homepage was very helpful.  That
> is essentially what I needed to do.  Based on that I came up with the
> following code.  It creates the new div and puts a Jmol applet in it.
> However, it does not load the molecule file into the the applet.  The
> message bar at the bottom of the window shows the following error
> message: script compiler ERROR: command expected----    >>>>"load ../
> Jmol/jmol/Models/benzene.smol;"<<<<
>
> Additionally, the alert(result1) (see code below) displays undefined
> in the alert box and alert(result2) displays a blank alert box.  So
> I'm wondering what is going on with that.
>
> Here is the code.  molecule refers to a structure filename.  Thanks to
> Bob for the divFind and divWrite functions.
>
> function divFind(name,issilent){
>        var d=document.getElementById(name);
> //      if(!d&&!issilent&&debugPrint)debugPrint("couldn't find "+name,1)
>        return d
> }
>
> function divWrite(name,what){
>        result1 = jmolGetStatus("scriptStatus");
>        alert(result1);
>        var d=divFind(name);
>        if(!d)return 0;
>        try{d.innerHTML=what}catch(error){alert(error)};
>        result2 = jmolGetStatus("scriptStatus",divInc);
>        alert(result2);
>        return d;
> }
>
> function jmolObject(molecule, divID){
>        jmolSetDocument(false);
>        this.loadString = "\"load ../Jmol/jmol/Models/" + molecule + ";" +
> "\"";
>        alert(this.loadString);
>        divWrite(divID,jmolApplet(400, this.loadString,divInc));
> }
> var divInc = 0;
> function newJmolDiv(molecule) {
>        var newDiv = document.createElement('div');
>        newDiv.id = 'Div' + (++divInc);
>        document.body.appendChild(newDiv);
>        jmolObject(molecule, newDiv.id);
> }
>
> ***********************************************
> Jeff Hansen
> Department of Chemistry and Biochemistry
> DePauw University
> 602 S. College Ave.
> Greencastle, IN 46135
> [EMAIL PROTECTED]
> ***********************************************
>
>
> On Aug 28, 2008, at 2:41 PM, Angel Herráez wrote:
>
> > Hi Jeff
> >
> > Not sure after the flurry of messages if you have solved your problem.
> >
> > On 27 Aug 2008 at 16:21, Jeff Hansen wrote:
> >
> >> Unfortunately both off these do the same thing which is to write the
> >> function used to create the Jmol applet object into the into the
> >> div as text.
> >
> > That may be due, as Bob has pointed out, to the need to use
> > jmolSetDocument(0)
> >
> >
> >> being added is text. I can't find anywhere that gives an example
> >> off adding some other kind of o
> >
> > Have you checked out the method used in Jmol homepage? I'm not sure
> > if that's what you
> > are after. A similar solution is what I once called "pop-in" method
> > for inserting Jmol applet
> > upon user request. This is used in Jmol app Export to Web module
> > (Pop-in Template) and
> > in
> >
> > I haven't tested those in Firefox 3 though (I'm yet sticking to 2.0
> > until my favorite add-ons
> > are updated).
> >
> >
> > -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> > challenge
> > Build the coolest Linux based applications with Moblin SDK & win
> > great prizes
> > Grand prize is a trip for two to an Open Source event anywhere in
> > the world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > _______________________________________________
> > Jmol-users mailing list
> > Jmol-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>



-- 
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
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to