Jump to content

max_peed

Members
  • Posts

    1
  • Joined

  • Last visited

max_peed's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hi! Im trying to make a button update the backgroundcolor of a <div>, with the colorvalue of a text input field. It kindof works in FF when i press F5 but not w the button, and IE and Chrome wont work.I think i need to get the button to refresh, but i dont know how to... my code is var button = document.getElementById("bCol");var inputten = document.getElementById("iCol").value;var diven = document.getElementById("diven"); if(button.addEventListener){button.addEventListener("click", ImgPicker.changeCol(inputten), false);} else{button.attachEvent("onclick", ImgPicker.changeCol(inputten));} and in ImgPicker, this one will search through the CSSfile for my diven-class changeCol: function(color){for(var i = 0; i < document.styleSheets.length; i++){for(var x = 0; x < document.styleSheets[i].cssRules.length; x++){if(document.styleSheets[i].cssRules[x].selectorText == ".diven"){document.styleSheets[i].cssRules[x].style.cssText = "background-color: " + color;refresh;}}}} Please, help?
×
×
  • Create New...