Hello Aya
You seem to have several different issues. Let's try to sort out
things with your problem.
Your "function rotateModel" should be a Javascript function. First,
you need the proper javascript syntax (you are lacking the braces and
you should not use "end"). Second, the call to Jmol.js is separate
from any other script; the way you have it, it is just being ignored.
Third, you cannot call the Jmol script directly but must pass it
trough jmolScript():
<head>
<script src="Jmol.js" type="text/javascript" >
</script>
<script type="text/javascript" >
function rotateModel()
{
jmolScript('rotate {atomno=1} {atomno=2} 90;')
}
</script>
</head>
Then, you can call that javascript function, but not inside
jmolRadioGroup or JmolButton:
<body>
<input type="button" value="RotateButton" onClick="rotateModel()">
So, that's not the best way to do it. Let's try something different:
<head>
<script src="Jmol.js" type="text/javascript" >
</script>
</head>
<body>
<script type="text/javascript">
jmolInitialize(".")
jmolHtml("RadioGroup Sample: ");
jmolRadioGroup([
["rotate {atomno=1} {atomno=2} 90", "Rotate"]
]);
jmolBr();
jmolHtml("Menu Sample: ");
jmolMenu([
["rotate {atomno=1} {atomno=2} 90", "Rotate"]
]);
jmolBr();
jmolHtml("Button Sample: ");
jmolButton("rotate {atomno=1} {atomno=2} 90","RotateButton");
</script>
<script type="text/javascript">
jmolApplet(290,"load models/practice.pdb;select all;spacefill
25%;wireframe .15;color cpk;zoom 120",0)
</script>
</body></html>
Note I have added a call to jmolInitialize(). This is not completely
complusaory, but it is highly recommended (unless you know well what
you are doing).
> I am working on something of a webpage project, where I must utilize
> a java applet, Jmol, in an html page. I don't know if this is a lack
> of knowledge in html, java, or jmol (most likely all three) that is
> hindering me from being productive, but I am having a hard time
> finding where to place the java functions and the code that
> references them relative to the html formatting. Any suggestions?
1. You don't need to know any Java language.
2. There are no Java functions involved. It's Javascript, no Java.
Most is done with Javascript thaks to the Jmol.js library that
interfaces with Jmol.
> No matter where I put my function, if I try calling it in the same
> script When I put the functions in the same
Your function was malformed.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users