1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
   | function colorPicker () {
	var cp;
 
	this.createColorPicker=function(){
		var imgBase = 'creating/';
 
			//On crée la fenêtre contenant le sélecteur de couleur
			var CE1=null;
			CE1=document.createElement("div");
			CE1.id='ColorPicker';
			document.getElementById("act").insertBefore(CE1,null);
			var txt=document.createTextNode("Select color : ");
			document.getElementById("ColorPicker").appendChild(txt);
	}
 
	this.attachColorPicker=function()
	{
		 this.createColorPicker();
		 this.SetId()
		 this.SetEvents();
	}
 
	this.SetEvents=function(){
 
		addEvt(this.cp.ColorPicker,"click",this.hideColorPicker);
	}
 
	this.SetId=function(){
		this.cp.ColorPicker=document.getElementById("ColorPicker");
	}
 
	this.addEvt=function(o,e,f){ 
			if(window.addEventListener) o.addEventListener(e, f, false); 
				else o.attachEvent("on"+e,f);
	}
 
	this.hideColorPicker=function(){
		this.cp.ColorPicker.style.display  = 'none';
		alert("fin");
		return false;
	}
} | 
Partager