Please note that ExpatTech is close for the Christmas and New Year holidays. We will re-open on 2nd January 2024.

ExpatTech Techblog

Pető Zsolt 2008.11.19. 11:21

Changing website element properties dynamically

Sometimes very useful to change the properties of a website element when an event occurs. The key is the style member of the object.

function ChangeSomething()
{
    var obj = document.getElementById('valami');
    obj.style.backgroundColor = "#f0f0f0";
    obj.readOnly = true;
}


And here's the a list of Javascript equvivalent of the css properties: http://codepunk.hardwar.org.uk/css2js.htm