Hello Klaus
I think that it should be possible to do what you want without using eval(),
which is usually not recommended by javascript gurus.
The variable is indeed an object and not a string, but that is what Jmol
expects.
There may be a problem when the variable has not been defined
beforehand; not sure if it will be your case. The trick in that case is to
define
it first like
myJmol = "myJmol"
Better:
I made a page with your functions and it is working as desired when I use it
like this
<input type="button" value="test A" onClick="KS_AtomeHervorheben(A)">
but I get the error when I use it like this:
<input type="button" value="test A" onClick="KS_AtomeHervorheben('A')">
So the issue would be you must pass the object, not the name.
If you don't want to write the object manually, like I did, I suggest that you
use the following instead of eval; one way to refer to objects ny their name is
to use
window[objectname]
That would allow for example this to apply to all Jmol objects named A, B, C,
D:
function setAll() {
for (i=65; i<69; i++) {
KS_AtomeHervorheben( window[String.fromCharCode(i)] )
}
}
<input type="button" value="test all" onClick="setAll()">
> However, one more problem remains. After converting the script to the new
> syntax using
> The code will run in my JSmol enviiroment, but not in the Jmol
> environment.
> either the new syntax is not compatible to the old Jmol using JAVA,
> or that I did not include all necessary files in my html document. Which
> files (beside the old Jmol.js) do I have to include?
It is compatible, but you must be moving to new syntax also for the Java
mode. You must not use Jmol.js any longer, instead just change:
Info.use = 'java'
Info.use = 'html5' // default
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers