From: Joost V. D. <jv...@ul...> - 2005-04-14 11:22:35
|
Thanks for the help, Bob! I'm using another script now to evaluate the state of the checkboxes, but y= our note about the resetting on load was invaluable! That's really a prerequisite. cheers, Joost >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=3Djavascript>function myfunction(n,c){alert(n+" "+c)}</sc= ript> ><body onload=3Ddocument.info.reset()> ><form name=3Dinfo> ><input name=3Dbtn1 type=3Dcheckbox onclick=3D"myfunction(name,checked)"> ><input name=3Dbtn2 type=3Dcheckbox onclick=3D"myfunction(name,checked)"> ></form> ></body> > >This way your function can know which button was clicked and whether it is= now=20 >checked or not. Note the form reset in the body tag. This is important,=20 >otherwise your page might be reloaded, and the state of the model won't=20 >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 wil= l >>>have to generate pages on the fly. >>> >>>Right now I use a javascript to execute jmol scripts from a website list= ed >>>a Wiki. The functionality looks something like this: >>>---------- >>><script LANGUAGE=3D"JavaScript" TYPE=3D"text/javascript"> >>>function scriptMe(command){ >>>=09document.jmol.script(command); >>>} >>></script> >>> >>>. >>>. >>>. >>>. >>> >>><input type =3D"button" name=3D"color" value=3D"By chain" >>>onClick=3D"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 >>=20 >>=20 >> I am in a hurry and cannot read your code in detail at this time ... >>=20 >> I strongly recommend that you use the Jmol.js JavaScript library. >>=20 >> You can still generate pages on the fly that reference this library. >>=20 >> 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. >>=20 >>=20 >> Miguel >>=20 >>=20 >>=20 >> ------------------------------------------------------- >> 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_id=14396&op=CCk >> _______________________________________________ >> Jmol-users mailing list >> Jmo...@li... >> https://lists.sourceforge.net/lists/listinfo/jmol-users > >--=20 > >Robert M. Hanson, ha...@st..., 507-646-3107 >Professor of Chemistry, St. Olaf College >1520 St. Olaf Ave., Northfield, MN 55057 >mailto:ha...@st... >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_id=14396&op=3Dcick >_______________________________________________ >Jmol-users mailing list >Jmo...@li... >https://lists.sourceforge.net/lists/listinfo/jmol-users > > ----- ----- Interdisciplinary Research Institute=20 for Human and Molecular Biology (IRIBHM) Faculty of Medicine Free University of Brussels Belgium=20 ----- d(^_^)b |