Sudeep,

* $Date: 2004/12/11 22:22:10 $
* $Revision: 1.28 $

You're using an old version of Jmol.js. Use the one at

http://jmol.sourceforge.net/download/

and you should be fine.

Sudeep Prajapati wrote:

Dear Bob,
Thank you for your quick responses.

You explained why we get "undefined" when we remove jmolSetDocument(0). But
when we add jmolSetDocument(0), then it doesn't show us the applet at all.
When we check the javascript console, it gives the error, "TypeError-object
(result of expression jmolSetDocument) does not allow calls." Why do we get
this error, and more importantly, what do we change to get the applet to
work.
You could check our site: people.depauw.edu/jhansen/chem/trialx.htm and
jmollayout.js in the same directory.

Sudeep


On 12/6/05 8:15 AM, "Bob Hanson" <[EMAIL PROTECTED]> wrote:

jmolSetDocument(0) indicates that the applet HTML code should not be
written directly to the page. Rather, the code should be returned
in a string to the calling function. Without jmolSetDocument(0), the
Jmol.js functions write to the page -- that's why you see the applet,
although not in the desired location -- but also the jmollayout.js
function is writing to the page what was supposed to be a return from
the Jmol.js function. Without jmolSetDocument(0), that return is
undefined, so that is what is written.


Sudeep Prajapati wrote:
We found that when we delete the line "jmolSetDocument(0)" in your
jmollayout.js, the applet loads fine and shows the structures. However, now
it displays "undefined undefined undefined" under the buttons; any
suggestion why this is happening?

Sudeep



On 11/28/05 12:07 PM, "Bob Hanson" <[EMAIL PROTECTED]> wrote:


Sudeep,

I think what you are after is a general .js file that you can add in a
<script> tag to add general functionality. Here's what I recommend:

Use the new Jmol.js functionality

jmolSetDocument(0)

What this does is turn off the automatic writing of the applet code to
the page as the page loads. Now, you could build your own little
function, such as:

isinitialized=0 //necessary if more than one applet is to be written

function myLayout(filename){
if(!isinitialized)jmolInitialize("..")
isinitialized=1
jmolSetDocument(0)
var sappcode=jmolApplet(300,"load "+filename)
var sbutton1=jmolButton(
"select *;spacefill on;wireframe off","spacefill")
var sbutton2=jmolButton(
"select *;wireframe on;spacefill off","wireframe")

var sout="<table><tr><td>"+sappcode+"</td></tr>"
+"<tr><td>"+sbutton1+" "+sbutton2+"</td></tr></table>"

document.write(sout)
}

That sort of thing. You would put this function in a jmollayout.js
file and add it to any page like you do Jmol.js. You could make it as
flexible as you need to. Then, where you might have put


<script type="text/javascript">
jmolInitialize()
jmolApplet(...)
....
</script>


Just insert something like:

<script type="text/javascript">myLayout("myfile.pdb")</script>

Is that what you are after? I've put up a simple example as

http://www.stolaf.edu/people/hansonr/jmol/docs/examples/layout.htm
http://www.stolaf.edu/people/hansonr/jmol/docs/examples/jmollayout.js

Bob Hanson



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to