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

--

Robert M. Hanson, [EMAIL PROTECTED], 507-646-3107
Professor of Chemistry, St. Olaf College
1520 St. Olaf Ave., Northfield, MN 55057
mailto:[EMAIL PROTECTED]
http://www.stolaf.edu/people/hansonr

"Imagination is more important than knowledge."  - Albert Einstein


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