I have a simple gadget where I have 4 different color .png bachground colors. The default is red and I want a user to be able to enter settings and choose the background color. I think I'm close, but if someone could give some pointers, I would really appreciate it.
You see the bold else If I add and remove that by hand, I can change the color and then change the color back after I remove it. Any thoughts looking at the code I am a beginner, so any help is once again very moch appreciated.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Settings</title>
<script type='text/javascript' src="js\Settings.js"></script>
<script>
System.Gadget.onSettingsClosing = SettingsClosing
function SettingsClosing(event){
if (value="red")
System.Gadget.background = "url(/images/backgroundRed.png)"
else
if (value="Silver")
System.Gadget.background = "url(/images/backgroundSilver.png)"
if (value="Green")
System.Gadget.background = "url(/images/backgroundGreen.png)"
if (value="Blue")
System.Gadget.background = "url(/images/backgroundBlue.png)"
}
</script>
</head>
<body onload="init() " style="width:250;height:200;">
<span id="spanConfig" style="font-family: Segoe UI; font-size: 12pt;">
<strong>Choose a Color</strong>
<form method="post">
<input id="Red" type="checkbox" value="Red"> Red</form>
<form method="post">
<input id="Silver" type="checkbox" value="Silver"> Silver</form>
<form method="post">
<input id="Green" type="checkbox" value="Green"> Green</form>
<form method="post">
<input id="Blue" type="checkbox" value="Blue"> Blue</form>
</span>
</body>
</html>

Using Settings to Choose Color of Gadget
haughki
I very much appreciate the reply, but that does not change the color. The default of red does not change.
Maybe something (most likely) on my settings.js file.. Like I said, new to this, but trying to make some sense on my own before asking for help.
Settings.js
function init()
{
var id = System.Gadget.Settings.read(id="");
if (sColorName != "")
{
ColorName.value = sColorName;
}
}
function SettingsClosing(event)
{
if (event.closeAction == event.Action.commit)
{
System.Gadget.Settings.write("id", ColorName.value);
}
event.cancel = false;
}
Alexei Pavlov aka BlackTiger
settings.html (drop the forms and use radio buttons)
<html>
<head>
<script language="javascript" type="text/javascript" src="js\Settings.js"></script>
</head>
<body onload="init();" style="width:250px; height:200px;">
<input name="colour" type="radio" value="Silver">  Silver<BR>
<input name="colour" type="radio" value="Green">  Green<BR>
<input name="colour" type="radio" value="Blue">  Blue<BR>
</html>
In settings.js add the following:
System.Gadget.onSettingsClosing = settingsClosing
var colours = ["red", "silver", "green", "blue"];
function settingsClosing(event){
event.cancel = false;
In your gadget.js file add the following:
System.Gadget.onSettingsClosed = settingsClosed;
function settingsClosed() {
Yulia
Thanks for the input. However, that did not seem to do anything either. To help and ask for a little more help, I have made the gadget available by download the the following link.
http://www.blogcastrepository.com/upload/tbrlinkshelp.zip
If anyone sees the problem, just post which file and the possible fix. Thanks! I really appreciate it.
Once I get the main background, I want to take what I have learned from that and have the flyout match. Please don't do that for me, I think if I can get the main part, I will be able to work out the flyout.
mike_b_a
Daikoku
function SettingsClosing(event){
if (value=="red")
{System.Gadget.background = "url(/images/backgroundRed.png)"}
if (value=="Silver")
{System.Gadget.background = "url(/images/backgroundSilver.png)"}
if (value=="Green")
{System.Gadget.background = "url(/images/backgroundGreen.png)"}
if (value=="Blue")
{System.Gadget.background = "url(/images/backgroundBlue.png)"}
}
tamasu