日期:2014-05-16  浏览次数:20382 次

JS IE的颜色选择器

安徽电信 :刘佳兴做的,关于调整背景颜色和字体颜色的,在基础配置——UI自定义配置中

?

1.?? <OBJECT id="colorPicker" CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b"
width="0px" height="0px"></OBJECT>

?

2.?? var color = "";
?function chooseColor(type){
??color = colorPicker.ChooseColorDlg();
??//转换为16进制
??color = color.toString(16);
??//点击取消时返回
??if(color == 0){
???return;
??}
??if(color.length < 6){
???color = "000000".substring(0,6-color.length).concat(color);
??}
??color = "#" + color;
??//为文本框赋值??
??$(type).value = color;
??if(type == "background"){
???Element.removeClassName("background","background");????//删除哪个id的哪个样式属性
???Element.setStyle(type,{background:color});???//给哪个id的哪个样式设置属性
??}
??if(type == "font"){
???Element.setStyle(type,{color:color});
??}
?}

?

3.?? 刷新缓存中的数据

//刷新缓存中的Configs
ConfigApp configApp = new ConfigApp(configService.loadConfigs());
this.refreshApplication("configApp", configApp);

?

public void refreshApplication(String key, Object value) {
??ServletContext context = this.getServlet().getServletContext();
??context.setAttribute(key, value);
?}

?