I have a link in HTML page with background image coming from CSS class. How can I change that background image by javascript?

document.getElementById('lnkSubmit').style.backgroundImage is not working.

Assuming getElementById() is returning the correct element, it should be:

e.style.backgroundImage = 'url(somepic.jpg)';

If that doesn’t work, try dumping its value in an alert before trying to assign it:

alert(e.style.backgroundImage);

Could be a useful reality check.