Ali_dotNet Ali_dotNet - 1 year ago 135
Javascript Question

change image opacity using javascript

how can I change image opacity using javascript? I'm going to create a fading effect using javascript, is there any sample? is there anything like image.opacity that can be changed through JS code? how is it set?


Answer Source

Supposing you're using plain JS (see other answers for jQuery), to change an element's opacity, write:

var element = document.getElementById('id'); = "0.9";  = 'alpha(opacity=90)'; // IE fallback
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download