Dear Jonathan,
I think is mostly the second one as the function you see below print html text
which is static. However the variable scriptColor must be changed as the user
deal with the page.
var scriptColor ="";
function createAppearanceGrp(){
var strApp="<form id='appearanceGroup' name='appearanceGroup'
style='display:none'>";
.......
strApp+=" " + createList2("colourbyElementList",
"elementSelected(value)", "", 1) + "\n"; //this create the list which is filled
by another function. On change you call the function elementSelected() (see
below.
strApp+="<tr><td>Colour</td><td colspan='2'><script
type='text/javascript'>\n";
strApp+="JmolColorPickerBox(" + scriptColor + ",[255,255,255]); \n";
strApp+="</script> </td></tr><tr><td align=left>";
.....
strApp+="</td></tr></table> \n";
strApp+="</form>\n";
return strApp;
}
function elementSelected(element){
scriptColor = "' color " + element + " $COLOR$'";
return scriptColor;
}
Thanks, Piero
--
Please consider the environment before printing this e-mail.
Pieremanuele Canepa
Room 104
Functional Material Group
School of Physical Sciences, Ingram Building,
University of Kent, Canterbury, Kent,
CT2 7NH
United Kingdom
e-mail: [email protected]
mobile: +44 (0) 7772-9756456
-----------------------------------------------------------
________________________________________
From: Jonathan Gutow [[email protected]]
Sent: Tuesday, July 13, 2010 5:59 PM
To: [email protected]
Subject: Re: [Jmol-users] problem setting element colors with
JmolColorPickerBox
Piero,
Please include the part where you call the ColorPickerBox. You are supposed to
pass the ColorPickerBox the string, which in the formulation you provide may
not have the necessary space before the color.
I'm unclear on exactly what you are trying to do. The ColorPickerBox
substitutes the color the user chooses for $COLOR$ in the script you provide.
Another possibility is that you are running up against the fact that
JmolColorPickerBox is writing html and javascript to your page dynamically, but
does not have a mechanism for updating the script once the box is created. If
that is the problem I will have to think on it a little. We can also consider
making a version that passes the color to a function of your choosing. Then
you could send a script that is modified on the fly.
Jonathan
On Jul 13, 2010, at 8:03 AM,
[email protected]<mailto:[email protected]>
wrote:
Date: Tue, 13 Jul 2010 11:44:57 +0100
From: P.Canepa <[email protected]<mailto:[email protected]>>
Subject: [Jmol-users] problem setting element colors with
JmolColorPickerBox
To: "[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Message-ID:
<[email protected]<mailto:[email protected]>>
Content-Type: text/plain; charset="us-ascii"
Dear all,
do you know why JmolColorPickerBox( doesn't work ? The string scriptColor =
"' color " + element + " $COLOR$'"; s correctly written.
var scriptColor = "";
function elementSelected(element){
scriptColor = "' color " + element + " $COLOR$'";
return scriptColor;
}
Dr. Jonathan H. Gutow
Chemistry Department
[email protected]<mailto:[email protected]>
UW-Oshkosh Office: 920-424-1326
800 Algoma Boulevard FAX:920-424-2042
Oshkosh, WI 54901
http://www.uwosh.edu/facstaff/gutow
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users