The answer is, yes, but you have to be careful. an HTML textbox has states checked and !checked. You can pass this state to a JavaScript function thusly:
<script language=javascript>function myfunction(n,c){alert(n+" "+c)}</script>
<body onload=document.info.reset()>
<form name=info>
<input name=btn1 type=checkbox onclick="myfunction(name,checked)">
<input name=btn2 type=checkbox onclick="myfunction(name,checked)">
</form>
</body>This way your function can know which button was clicked and whether it is now checked or not. Note the form reset in the body tag. This is important, otherwise your page might be reloaded, and the state of the model won't correspond to the state of the checkboxes initially.
Bob Hanson
Miguel wrote:
Hi,
I want to use html checkboxes to toggle eg. ribbons on or off. So, when checked, ribbons are on, when unchecked, ribbons are off. I'm writing the html page in plain html after loading the applet with <applet>...</applet>. This is the most convenient way for me since I will have to generate pages on the fly.
Right now I use a javascript to execute jmol scripts from a website listed a Wiki. The functionality looks something like this: ---------- <script LANGUAGE="JavaScript" TYPE="text/javascript"> function scriptMe(command){ document.jmol.script(command); } </script>
. . . .
<input type ="button" name="color" value="By chain" onClick="scriptMe('select *; color chain;')"/> -------------
Now, can I use checkboxes in the same way? If not in the same way ... another way? ;-) Thanks in advance!
Joost
I am in a hurry and cannot read your code in detail at this time ...
I strongly recommend that you use the Jmol.js JavaScript library.
You can still generate pages on the fly that reference this library.
If you decide that is not the right choice for you, then look at the Jmol.js source code for an example of how to use checkboxes.
Miguel
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op�k _______________________________________________ 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
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ Jmol-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jmol-users

