我想看看System.Gadget.onSettingsClosing是否有效,
这是我的代码
my.js
System.Gadget.settingsUI = "../Settings.html";
System.Gadget.onSettingsClosing = settingsClosing;
function settingsClosing(){
document.getElementById('banner').innerHTML = "Changed!";
}
但没有运气,tsk。
gadget.html
<div id = "banner">Not Changed</div>
答案 0 :(得分:0)
尝试将这些内容放入gadget.html脚本中:
System.Gadget.settingsUI = "../Settings.html";
function SettingsClosed(event){
if(event.closeAction===event.Action.commit){
[whatever - usually reading settings and then using them in some way]
}
}
System.Gadget.onSettingsClosed=SettingsClosed;
并将这些内容放入您的Settings.html脚本
中function SettingsClosing(event){
if(event.closeAction===event.Action.commit){
[whatever- usually saving settings]
event.cancel=false;
}
else{event.cancel=true;}
}
System.Gadget.onSettingsClosing=SettingsClosing;
请参阅: